Options To Request Or Suppress Warnings - Red Hat ENTERPRISE LINUX 3 - USING GCC Using Instructions

Using the gnu compiler collection (gcc)
Hide thumbs Also See for ENTERPRISE LINUX 3 - USING GCC:
Table of Contents

Advertisement

Chapter 4. GCC Command Options

4.8. Options to Request or Suppress Warnings

Warnings are diagnostic messages that report constructions which are not inherently erroneous but
which are risky or suggest there may have been an error.
You can request many specific warnings with options beginning
request warnings on implicit declarations. Each of these specific warning options also has a negative
form beginning
-Wno-
one of the two forms, whichever is not the default.
The following options control the amount and kinds of warnings produced by GCC; for further,
language-specific options also refer to Section 4.5 Options Controlling C++ Dialect and Section
4.6 Options Controlling Objective-C Dialect.
-fsyntax-only
Check the code for syntax errors, but don't do anything beyond that.
-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
Valid ISO C and ISO C++ programs should compile properly with or without this option (though
a rare few will require
ever, without this option, certain GNU extensions and traditional C and C++ features are sup-
ported as well. With this option, they are rejected.
does not cause warning messages for use of the alternate keywords whose names
-pedantic
begin and end with
__extension__
application programs should avoid them. Section 6.41 Alternate Keywords.
Some users try to use
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
have plans to support such a feature in the near future.
Where the standard specified with
or
, there is a corresponding base standard, the version of ISO C on which the GNU
gnu99
extended dialect is based. Warnings from
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
-w
Inhibit all warning messages.
-Wno-import
Inhibit warning messages about the use of
to turn off warnings; for example,
or a
-ansi
-std
. Pedantic warnings are also disabled in the expression that follows
__
. However, only system header files should use these escape routes;
to check programs for strict ISO C conformance. They soon
-pedantic
-std
, except that errors are produced rather than warnings.
-Wno-implicit
option specifying the required version of ISO C). How-
represents a GNU extended dialect of C, such as
are given where they are required by the
-pedantic
.
#import
, for example
-W
-Wimplicit
. This manual lists only
option used.
-std
-pedantic
27
to
. We don't
gnu89

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ENTERPRISE LINUX 3 - USING GCC and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Enterprise linux 3

Table of Contents