canonical / dqlite

Embeddable, replicated and fault-tolerant SQL engine.
https://dqlite.io
Other
3.77k stars 212 forks source link

configure: Disable default CFLAGS from AC_PROG_CC #651

Closed cole-miller closed 2 months ago

cole-miller commented 2 months ago

AC_PROG_CC adds some default compiler flags unless you tell it not to:

If using the GNU C compiler, set shell variable GCC to ‘yes’. If output variable CFLAGS was not already set, set it to -g -O2 for the GNU C compiler (-O2 on systems where GCC does not accept -g), or -g for other compilers.

(Source.)

Also tweak DEBUG_ENABLED handling in Makefile.am: we always pass -g3 in the basic CFLAGS set from configure.ac, so no point adding it again there. Instead, pass -O0, which should be the default but here serves as a kind of documentation.

Credit to @letFunny for noticing that -O2 was getting passed to gcc even for builds configured with --enable-debug.

Signed-off-by: Cole Miller cole.miller@canonical.com

cole-miller commented 2 months ago

FYI @freeekanayaka

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.43%. Comparing base (cb65db7) to head (334e23e). Report is 3 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #651 +/- ## ========================================== - Coverage 80.57% 77.43% -3.14% ========================================== Files 196 196 Lines 28301 27233 -1068 Branches 5300 5492 +192 ========================================== - Hits 22803 21089 -1714 - Misses 3767 4383 +616 - Partials 1731 1761 +30 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

cole-miller commented 2 months ago

I've confirmed locally that this results in the intended CFLAGS being placed into the generated Makefile.