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

Fix build warnings, so Ubuntu CI can pass --werror to meson #13317

Merged
merged 3 commits into from Aug 16, 2019

Conversation

ddstreet
Copy link
Contributor

@ddstreet ddstreet commented Aug 13, 2019

UPDATE: removed commit to always pass werror to meson; this can be done separately from Ubuntu CI, so normal builds don't use the param. Also, the src/boot/efi/ build is changed so instead of always passing -Werror to gcc, it only does so if the meson get_option('werror') is true.

Original description:

The first 2 commits restrict the use of arch-specific gcc attributes to only the archs they are valid for.

The 3rd commit adds 'werror=true' to the project default meson params, which adds the gcc option -Werror to the entire build, except EFI which builds by calling gcc manually.

The last commit adds -Werror to the EFI build calls to gcc.

@evverx suggested this here:
#13174 (comment)
#13137 (comment)

though that suggestion was to add it to the Ubuntu CI builds, not all builds. If you think it's better to allow warnings in the build by default, and enable werror only for CI runs, I can change it to pass meson the werror flag only for Ubuntu CI (though it might not be possible for Ubuntu CI to add the param for the EFI build, only the top-level meson call).

@ddstreet
Copy link
Contributor Author

The autopkgtest will fail for this, without the commits from #13318 and #13319

I will mark this WIP, and if those are merged i'll rebase this one.

@ddstreet ddstreet changed the title Add meson -werror to build, to fail on any warnings WIP: Add meson -werror to build, to fail on any warnings Aug 13, 2019
src/boot/efi/meson.build Outdated Show resolved Hide resolved
@keszybz
Copy link
Member

keszybz commented Aug 14, 2019

The first two commits looks nice. But I don't think we should enable -Werror by default. It is OK as a developer tool, to catch any issues early in a controlled environment, but it is unsuitable to distributed code or code that is compiled in changing environments. In particular, it creates a "time bomb" of code which compiles fine but might stop compiling after the next glibc or compiler update.

@ddstreet
Copy link
Contributor Author

ddstreet commented Aug 14, 2019

The first two commits looks nice. But I don't think we should enable -Werror by default. It is OK as a developer tool, to catch any issues early in a controlled environment, but it is unsuitable to distributed code or code that is compiled in changing environments. In particular, it creates a "time bomb" of code which compiles fine but might stop compiling after the next glibc or compiler update.

ack; I can move the meson -werror=true param to Ubuntu CI's call to meson, so it would only run during Ubuntu CI, if that sounds ok to you.

I'm not sure if the -Werror addition to the EFI build can be done from Ubuntu CI, though.

Dan Streetman added 2 commits August 15, 2019 16:36
This attribute is x86-only, so when building on non-intel archs it
generates a compiler warning.  When building with -Werror this turns
into an error, so only include the attribute on intel archs.
This attribute is x86_32-only, so when building on non-intel archs it
generates a compiler warning.  When building with -Werror this turns
into an error, so only include the attribute on i386 arch builds.
This part of the build does not use the normal meson parameters, so
we need to explicitly check for the meson --werror parameter, and if
it's true, set the gcc -Werror parameter for this subdir's build.
@ddstreet ddstreet changed the title WIP: Add meson -werror to build, to fail on any warnings Fix build warnings, so Ubuntu CI can pass --werror to meson Aug 16, 2019
@ddstreet
Copy link
Contributor Author

Ok, force pushed to remove the meson --werror commit, and updated the commit to the src/boot/efi/meson.build so it only passes -Werror to gcc if --werror has been passed to the main meson build.

@yuwata
Copy link
Member

yuwata commented Aug 16, 2019

Maybe, meson_options.txt should be also updated?

@mbiebl
Copy link
Contributor

mbiebl commented Aug 16, 2019

Maybe, meson_options.txt should be also updated?

--werror is a builtin meson command line parameter

@yuwata
Copy link
Member

yuwata commented Aug 16, 2019

Oh, I did not know that. Thanks.

@keszybz
Copy link
Member

keszybz commented Aug 16, 2019

LGTM.

@keszybz keszybz merged commit 3a2acd9 into systemd:master Aug 16, 2019
@ddstreet ddstreet deleted the werror branch July 1, 2021 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants