Gcc make: how to disable warning failure?

I am trying to create gcc for use with the AVR and avr-ada microcontroller and I hit the checkpoint caused by the fact that my regular compiler was too picky about the version I need for AVR. I get the following warning, which in turn causes gcc or make to report an error:

gcc -c -g -O2 -gnatpg -gnata -nostdinc -I- -I. -Iada -I../../gcc/ada ../../gcc/ada/exp_ch5.adb -o ada/exp_ch5.o exp_ch5.adb:177:16: warning: function "Has_Address_Clause" is not referenced make[2]: *** [ada/exp_ch5.o] Error 1 make[1]: *** [all-gcc] Error 2 make: *** [all] Error 2 

Is there a way to tell gcc or make not to fail on warning?

+7
c gcc ada makefile
source share
7 answers

The trigger here is -gnatpg (actually, -gnatg): this is the "GNAT implementation mode (used to compile GNAT units)." -gnatp means suppress all checks.

I'm not sure about the full effect of -gnatg, although this certainly forces warnings to handle errors like -Werror, at least when creating the compiler itself; I think I remember that during the creation of RTS non-fatal warnings were observed.

One possibility would be to compile only exp_ch5.adb manually without -gnatg; the command you specified was released in gcc /, so

 $ cd gcc $ gcc -c -g -O2 -gnatp -gnata -nostdinc -I- -I. -Iada -I../../gcc/ada \ ../../gcc/ada/exp_ch5.adb -o ada/exp_ch5.o 

Then go back one level and do it again.

This is a cross-compiler, so you won’t (I hope!) Need to repeat this for all three stages of a complete build.

+5
source share

Try make -k instead of just make . It will continue, not stop.

+32
source share

As an alternative to diving into the build system, try setting -Wno-error to CFLAGS, which you must run through the environment (or during setup if using the GNU build system).

+8
source share

In general, it is not recommended to ignore warnings from your compiler. However, if it is part of a larger make process, it is most likely that the -Werror flag is inserted earlier in the sequence. Start by searching.

Looking back, there seem to be a lot of flags for managing warnings when compiling Ada code. For example, -gnatwF will suppress warnings in unpublished formats in accordance with this guide . Perhaps the required switch can be found in the list provided there.

+4
source share

The Make-make flag seems to be set to Makefile. Perhaps you can find the CFLAGS options in the Makefile and remove the -Werror flag. The Werror flag will make all warnings erroneous.

+3
source share

In gcc configure, you can add --disable-werror .

Although it is advisable to first find the right patch.

+2
source share

How about including "pragma warnings (off," ... ")" in the offensive parts of your code?

See http://www.adacore.com/2007/11/19/ada-gem-18/ .

0
source share

All Articles