Search code examples
linuxgccmakefilegnu-makecc

Have 'make' not output "redirecting incorrect #include" warnings during CC/GCC build?


Is there any flag to get 'make' to not output "redirecting incorrect #include" messages during a CC/GCC building?

I get that --disable-warnings-as-errors might do, but is there a more specific one?

Example output that's wanted to be silenced:

In file included from ./src/or/or.h:31:0,
                 from src/test/test_routerlist.c:12:
/usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Wcpp]
 #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>

Solution

  • I can't reproduce (my copy of sys/fcntl.h is #include <fcntl.h>), but try adding -Wno-cpp to your cflags. From man gcc:

       -Wno-cpp
           (C, Objective-C, C++, Objective-C++ and Fortran only)
    
           Suppress warning messages emitted by "#warning" directives.
    

    In general, the option that triggered the warning is printed along with the warning (-Wcpp for you). You can disable specific warnings with the -Wno-<warning> flag.