Project

General

Profile

Actions

Bug #5750

open

contrib/jenkins.sh: build with -Wunused-macros and -Wundef

Added by fixeria over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
11/09/2022
Due date:
% Done:

0%

Spec Reference:

Description

According to man cpp:

       -Wundef
           Warn if an undefined identifier is evaluated in an "#if" directive.
           Such identifiers are replaced with zero.

       -Wunused-macros
           Warn about macros defined in the main file that are unused.  A macro
           is used if it is expanded or tested for existence at least once.  The
           preprocessor also warns if the macro has not been used at the time it
           is redefined or undefined.

           Built-in macros, macros defined on the command line, and macros
           defined in include files are not warned about.

           Note: If a macro is actually used, but only used in skipped
           conditional blocks, then the preprocessor reports it as unused.  To
           avoid the warning in such a case, you might improve the scope of the
           macro's definition by, for example, moving it into the first skipped
           block.  Alternatively, you could provide a dummy use with something
           like:

                   #if defined the_macro_causing_the_warning
                   #endif

I think it would be good to have these options enabled during the build verification.

With this option enabled, I quickly found a copy-paste bug in osmo-bsc:

https://gerrit.osmocom.org/c/osmo-bsc/+/30058

No data to display

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)