Skip to content

Commit

Permalink
Merge pull request #1245 from matthiasblaesing/gcc10
Browse files Browse the repository at this point in the history
Fix build error on GCC 10 caused by alloca bound warnings
  • Loading branch information
matthiasblaesing authored Aug 11, 2020
2 parents 690def8 + 96c5df1 commit 816fdd2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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

0 comments on commit 816fdd2

Please sign in to comment.