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

Pass -Wno-error to linker in case of LTO builds #719

Merged
merged 1 commit into from
Nov 18, 2015

Conversation

akosthekiss
Copy link
Member

When linking a release-built command line shell on Linux against
default glibc with LTO enabled, a long-open gcc bug causes spurious
warning to be emitted around a call to fread. The -Werror flag
turns this into an error and the build process fails.
Unfortunately, there is no way to selectively disable the warning
with pragmas or -Wno-error=xxx flags.

Thus, this patch passes -Wno-error to the linker in case of LTO
builds. (But only to the linker. The compilation still applies the
warnings-are-errors policy.)

fixes #718

@egavrin
Copy link
Contributor

egavrin commented Nov 12, 2015

Do you have link for this issue?

@akosthekiss
Copy link
Member Author

Please, see at issue #718 , as mentioned above.

@akosthekiss
Copy link
Member Author

I've pushed a patch on top of the original to show the approach suggested by @ruben-ayrapetyan in #718 . The patches are intentionally not squashed for now so that we can compare and discuss the different approaches.

And yes, this also solves the problem. The warning is printed during release link but it causes no error.

@akosthekiss
Copy link
Member Author

I've improved the PR with macros to make the handling of warnings more compact and easier to maintain. Some of the macros could be utilized elsewhere in the CMakeLists.txt file as well but the changes are kept intentionally local for now.

add_jerry_compile_warnings(conversion sign-conversion format-security)
add_jerry_compile_warnings(missing-declarations)
add_jerry_compile_flags(-Wno-attributes)
add_jerry_compile_flags(-Wfatal-errors)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you, please, merge the above lists into two - for warnings and for other flags?

@ruben-ayrapetyan
Copy link
Contributor

Looks good to me

When linking a release-built command line shell on Linux against
default glibc with LTO enabled, a long-open gcc bug causes spurious
warning to be emitted around a call to fread. The `-Werror` flag
turns this into an error and the build process fails.
Unfortunately, there is no way to selectively disable the warning
with pragmas or `-Wno-error=xxx` flags.

Thus, this patch introduces some helper macros and lists all
warnings explicitly with `-Werror=xxx` instead of covering all
warnings with the `-Werror` flag. This way, warnings enabled by
command line flags do cause errors, but those raised by warning
attributes (which cannot be suppressed by any `-Wno-error=xxx`
flags) don't.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]
@LaszloLango
Copy link
Contributor

LGTM

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.

make release.linux USE_COMPILER_DEFAULT_LIBC=YES fails
4 participants