From Fedora Project Wiki

Revision as of 14:43, 2 June 2010 by Spot (talk | contribs) (Created page with 'This page serves as a reference for people who come across GCC errors, explaining the error and how to work around it. = Flags to be aware of = == -pedantic == When code is com...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page serves as a reference for people who come across GCC errors, explaining the error and how to work around it.

Flags to be aware of

-pedantic

When code is compiled with -pedantic, it enables a LOT of warnings. Specifically, it causes the compiler to issue all the warnings demanded by strict ISO C and ISO C++.

-Werror

When code is compiled with -Werror, it converts all warnings to errors (which cause the compiler to fail).

Warnings/Errors

string length 'XXX' is greater than the length '509' ISO C90 compilers are required to support

GCC is telling you that a string in your code is longer than the “minimum maximum” length specified in the C standard. The limit applies after string constant concatenation, and does not count the trailing NUL. In C90, the limit was 509 characters; in C99, it was raised to 4095.

Specifically, this is caused by -Woverlength-strings being used, either directly or implicitly via -pedantic.

To fix this issue, do one of the following:

  • limit the size of your string to the appropriate ISO C standard (the default is C90, for C99, pass -std=gnu99 to GCC)
  • pass -Wno-overlength-strings to GCC