Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure: Disable default CFLAGS from AC_PROG_CC #651

Merged
merged 1 commit into from
May 2, 2024

Conversation

cole-miller
Copy link
Contributor

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
Copy link
Contributor Author

FYI @freeekanayaka

Copy link

codecov bot commented May 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@letFunny letFunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@cole-miller
Copy link
Contributor Author

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

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.

Signed-off-by: Cole Miller <cole.miller@canonical.com>
@cole-miller cole-miller merged commit a4ed77b into canonical:master May 2, 2024
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants