Index: generic/tkFont.c ================================================================== --- generic/tkFont.c +++ generic/tkFont.c @@ -94,11 +94,11 @@ const char *string; /* The string that was layed out. */ int width; /* The maximum width of all lines in the text * layout. */ int numChunks; /* Number of chunks actually used in following * array. */ - LayoutChunk chunks[1]; /* Array of chunks. The actual size will be + LayoutChunk chunks[TKFLEXARRAY];/* Array of chunks. The actual size will be * maxChunks. THIS FIELD MUST BE THE LAST IN * THE STRUCTURE. */ } TextLayout; /* Index: generic/tkInt.h ================================================================== --- generic/tkInt.h +++ generic/tkInt.h @@ -78,10 +78,16 @@ # define TkSizeT size_t # else # define TkSizeT int # endif #endif + +#if defined(__GNUC__) && (__GNUC__ > 2) +# define TKFLEXARRAY 0 +#else +# define TKFLEXARRAY 1 +#endif #if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7) # define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int len, Tcl_DString *))Tcl_UniCharToUtfDString) # define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int len, Tcl_DString *))Tcl_UtfToUniCharDString) # define Tcl_Char16ToUtfDString Tcl_UniCharToUtfDString Index: generic/tkSelect.c ================================================================== --- generic/tkSelect.c +++ generic/tkSelect.c @@ -26,11 +26,11 @@ int charOffset; /* The offset of the next char to retrieve. */ int byteOffset; /* The expected byte offset of the next * chunk. */ char buffer[4]; /* A buffer to hold part of a UTF character * that is split across chunks. */ - char command[1]; /* Command to invoke. Actual space is + char command[TKFLEXARRAY]; /* Command to invoke. Actual space is * allocated as large as necessary. This must * be the last entry in the structure. */ } CommandInfo; /* Index: generic/tkText.h ================================================================== --- generic/tkText.h +++ generic/tkText.h @@ -166,11 +166,11 @@ /* Next in list of segments for this line, or * NULL for end of list. */ TkSizeT size; /* Size of this segment (# of bytes of index * space it occupies). */ union { - char chars[2]; /* Characters that make up character info. + char chars[TKFLEXARRAY]; /* Characters that make up character info. * Actual length varies to hold as many * characters as needed.*/ TkTextToggle toggle; /* Information about tag toggle. */ TkTextMark mark; /* Information about mark. */ TkTextEmbWindow ew; /* Information about embedded window. */ @@ -487,11 +487,11 @@ double lastTab; /* The accurate fractional pixel position of * the last tab. */ double tabIncrement; /* The accurate fractional pixel increment * between interpolated tabs we have to create * when we exceed numTabs. */ - TkTextTab tabs[1]; /* Array of tabs. The actual size will be + TkTextTab tabs[TKFLEXARRAY];/* Array of tabs. The actual size will be * numTabs. THIS FIELD MUST BE THE LAST IN THE * STRUCTURE. */ } TkTextTabArray; /* Index: generic/tkTextDisp.c ================================================================== --- generic/tkTextDisp.c +++ generic/tkTextDisp.c @@ -442,11 +442,11 @@ #if !TK_LAYOUT_WITH_BASE_CHUNKS typedef struct CharInfo { int numBytes; /* Number of bytes to display. */ - char chars[1]; /* UTF characters to display. + char chars[TKFLEXARRAY]; /* UTF characters to display. * Allocated as large as necessary. THIS MUST BE THE LAST * FIELD IN THE STRUCTURE. */ } CharInfo; #else /* TK_LAYOUT_WITH_BASE_CHUNKS */ Index: unix/tkUnixWm.c ================================================================== --- unix/tkUnixWm.c +++ unix/tkUnixWm.c @@ -26,11 +26,11 @@ struct ProtocolHandler *nextPtr; /* Next in list of protocol handlers for the * same top-level window, or NULL for end of * list. */ Tcl_Interp *interp; /* Interpreter in which to invoke command. */ - char command[1]; /* Tcl command to invoke when a client message + char command[TKFLEXARRAY]; /* Tcl command to invoke when a client message * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE * THE LAST FIELD OF THE STRUCTURE. */ } ProtocolHandler; Index: win/tkWinWm.c ================================================================== --- win/tkWinWm.c +++ win/tkWinWm.c @@ -56,11 +56,11 @@ struct ProtocolHandler *nextPtr; /* Next in list of protocol handlers for the * same top-level window, or NULL for end of * list. */ Tcl_Interp *interp; /* Interpreter in which to invoke command. */ - char command[1]; /* Tcl command to invoke when a client message + char command[TKFLEXARRAY]; /* Tcl command to invoke when a client message * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE * THE LAST FIELD OF THE STRUCTURE. */ } ProtocolHandler;