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 error on GCC 10 caused by alloca bound warnings #1245

Merged
merged 1 commit into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Features

Bug Fixes
---------

* [#1244](https://github.com/java-native-access/jna/issues/1244): Fix building on GCC 10 - [@matthiasblaesing](https://github.com/matthiasblaesing).

Release 5.6.0
=============
Expand Down
10 changes: 8 additions & 2 deletions native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,20 @@ endif
endif

# CC_OPTS only applied to objects build for jnidispatch, not for libffi
# -Wno-unknown-warning-option
# -Wno-unknown-warning-option
# => Suppress warning for unknown warnings
# -Werror => Treat warnings as errors
# -Wno-clobbered => Silence GCC warning about clobbered automatic variables.
# The "longjmp" case only happens in protect.h in the logic
# that implements "protected" mode. In that case an exception
# is raised and the value of the potentially clobbered
# variables is ignored.
# -Wno-alloca-larger-than => Silence warnings about unbounded alloca calls in
# the dispatch logic. GCC tries to assert, that the size of
# the allocated memory is bounded and thus a check for the
# variable needs to be inplace. For the JNA case, the size
# comes from the Java side, so checks are not visible on the
# C side and thus can't be checked there.
#
# Enable this only on GCC versions, that can work with it. It is assumed, that
# GCC version 4.X is the lower bound. That version is problematic, as it
Expand All @@ -337,7 +343,7 @@ ifeq ($(CC),gcc)
GCC_MAJOR_VERSION = $(shell gcc -dumpversion | cut -f 1 -d '.')
ifneq ($(GCC_MAJOR_VERSION),4)
ifneq ($(GCC_MAJOR_VERSION),3)
LOC_CC_OPTS=-Wno-unknown-warning-option -Werror -Wno-clobbered -Wno-unused-variable
LOC_CC_OPTS=-Wno-unknown-warning-option -Werror -Wno-clobbered -Wno-unused-variable -Wno-alloca-larger-than
endif
endif
else
Expand Down