gcc, make: how to disable fail on warning?

后端 未结 7 1281
天命终不由人
天命终不由人 2021-01-11 13:54

I\'m trying to build gcc for use with an AVR micro controller and avr-ada, and I\'ve hit a roadblock caused by my regular compiler being too picky about the version I needed

相关标签:
7条回答
  • 2021-01-11 14:05

    How about putting "pragma warnings(off, "...")" into the offending parts of your code?

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

    0 讨论(0)
  • 2021-01-11 14:09

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

    Though it's advisable to seek out a proper patch first.

    0 讨论(0)
  • 2021-01-11 14:10

    It seems -Werror flag is set in Makefile. Maybe you can look for CFLAGS options in Makefile and remove the -Werror flag. The Werror flag will make all warnings into errors.

    0 讨论(0)
  • 2021-01-11 14:10

    In general, it is not a good idea to ignore warnings from your compiler. However, if this is a portion of a larger make process there is likely a -Werror flag inserted earlier in the sequence. Start by looking for that.

    After looking around, there seems to be a wealth of flags to control warnings while compiling Ada code. For instance, -gnatwF will Suppress warnings on unreferenced formals according to this guide. Possibly the switch you require can be found in the list provided there.

    0 讨论(0)
  • 2021-01-11 14:14

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

    I'm not sure of the full effect of -gnatg, though it certainly causes warnings to be treated as errors -- like -Werror -- at any rate while building the compiler itself; I think I remember seeing non-fatal warnings while building the RTS.

    One possibility would be to compile just exp_ch5.adb by hand without -gnatg; the command you list was issued at 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 back up one level, and 'make' again.

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

    0 讨论(0)
  • 2021-01-11 14:17

    As an alternative to diving into the build system, try setting -Wno-error in CFLAGS, which you should be able to do through the environment (or at configure time, if using the GNU build system).

    0 讨论(0)
提交回复
热议问题