Author Topic: BUG: no such gcc switch as -pedantic-error  (Read 8004 times)

scorpion007

  • Guest
BUG: no such gcc switch as -pedantic-error
« on: November 02, 2006, 04:59:15 am »
The correct switch is -pedantic-errors -- it is plural.
Also, may i request a minor feature? Have an additional -ansi switch in the list. Of course it can be added in additional options, but its a fairly common switch.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5494
Re: BUG: no such gcc switch as -pedantic-error
« Reply #1 on: November 02, 2006, 08:11:56 am »
absolutely correct :


http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Warning-Options.html#index-pedantic-200
Quote
-pedantic
    Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions, and some other programs that do not follow ISO C and ISO C++. For ISO C, follows the version of the ISO C standard specified by any -std option used.

    Valid ISO C and ISO C++ programs should compile properly with or without this option (though a rare few will require -ansi or a -std option specifying the required version of ISO C). However, without this option, certain GNU extensions and traditional C and C++ features are supported as well. With this option, they are rejected.

    -pedantic does not cause warning messages for use of the alternate keywords whose names begin and end with `__'. Pedantic warnings are also disabled in the expression that follows __extension__. However, only system header files should use these escape routes; application programs should avoid them. See Alternate Keywords.

    Some users try to use -pedantic to check programs for strict ISO C conformance. They soon find that it does not do quite what they want: it finds some non-ISO practices, but not all—only those for which ISO C requires a diagnostic, and some others for which diagnostics have been added.

    A feature to report any failure to conform to ISO C might be useful in some instances, but would require considerable additional work and would be quite different from -pedantic. We don't have plans to support such a feature in the near future.

    Where the standard specified with -std represents a GNU extended dialect of C, such as `gnu89' or `gnu99', there is a corresponding base standard, the version of ISO C on which the GNU extended dialect is based. Warnings from -pedantic are given where they are required by the base standard. (It would not make sense for such warnings to be given only for features not in the specified GNU C dialect, since by definition the GNU dialects of C include all features the compiler supports with the given option, and there would be nothing to warn about.)
-pedantic-errors
    Like -pedantic, except that errors are produced rather than warnings.


http://gcc.gnu.org/onlinedocs/gcc-4.1.1/cpp/Invocation.html#index-pedantic-140
Quote
-pedantic
    Issue all the mandatory diagnostics listed in the C standard. Some of them are left out by default, since they trigger frequently on harmless code.
-pedantic-errors
    Issue all the mandatory diagnostics, and make all mandatory diagnostics into errors. This includes mandatory diagnostics that GCC issues without `-pedantic' but treats as warnings.

adjusted our sources : revision 3165
Thanks for pointing that out !!!

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5494
Re: BUG: no such gcc switch as -pedantic-error
« Reply #2 on: November 02, 2006, 08:16:08 am »
Quote
-ansi
    Specify the standard to which the code should conform. Currently CPP knows about C and C++ standards; others may be added in the future.

    standard may be one of:

    iso9899:1990
    c89
        The ISO C standard from 1990. `c89' is the customary shorthand for this version of the standard.

        The -ansi option is equivalent to -std=c89.
    iso9899:199409
        The 1990 C standard, as amended in 1994.
    iso9899:1999
    c99
    iso9899:199x
    c9x
        The revised ISO C standard, published in December 1999. Before publication, this was known as C9X.
    gnu89
        The 1990 C standard plus GNU extensions. This is the default.
    gnu99
    gnu9x
        The 1999 C standard plus GNU extensions.
    c++98
        The 1998 ISO C++ standard plus amendments.
    gnu++98
        The same as -std=c++98 plus GNU extensions. This is the default for C++ code.

one little question, is the option just : -ansi or do you need to specify one of those standards ??

scorpion007

  • Guest
Re: BUG: no such gcc switch as -pedantic-error
« Reply #3 on: November 02, 2006, 08:55:49 am »
for C, "The -ansi option is equivalent to -std=c89"
for C++, gnu++98 is the default.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5494
Re: BUG: no such gcc switch as -pedantic-error
« Reply #4 on: November 02, 2006, 09:01:34 am »
ok I will add this option, but it's a check box : yes or no, no possibility to add anything else to that specific option.

[EDIT] on second thought what's the benefit ?? for C/C++ is the same as the default ???
« Last Edit: November 02, 2006, 09:10:01 am by killerbot »

scorpion007

  • Guest
Re: BUG: no such gcc switch as -pedantic-error
« Reply #5 on: November 02, 2006, 09:30:08 am »
for C, it makes the compiler strictly adhere to the C89 standard. I.e you cannot use // comments, must declare all variables at beginning of scope, etc. Any attempt will flag an error.
Yes, a checkbox will suffice.

From man gcc:

       -ansi
           In C mode, support all ISO C90 programs.  In C++ mode, remove GNU extensions that conflict with
           ISO C++.

           This turns off certain features of GCC that are incompatible with ISO C90 (when compiling C
           code), or of standard C++ (when compiling C++ code), such as the "asm" and "typeof" keywords,
           and predefined macros such as "unix" and "vax" that identify the type of system you are using.
           It also enables the undesirable and rarely used ISO trigraph feature.  For the C compiler, it
           disables recognition of C++ style // comments as well as the "inline" keyword.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5494
Re: BUG: no such gcc switch as -pedantic-error
« Reply #6 on: November 02, 2006, 10:13:45 am »
done rev 3167

scorpion007

  • Guest
Re: BUG: no such gcc switch as -pedantic-error
« Reply #7 on: November 02, 2006, 10:53:58 am »
whoa, that was quick, thank you very much. I will get the next nightly build when its available.