After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 792718 - [PATCH] Don't declare functions in AC_TRY_COMPILE
[PATCH] Don't declare functions in AC_TRY_COMPILE
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
git master
Other FreeBSD
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2018-01-20 09:42 UTC by Ting-Wei Lan
Modified: 2018-01-24 09:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
configure: Don't declare functions in AC_TRY_COMPILE (master branch) (880 bytes, patch)
2018-01-20 09:43 UTC, Ting-Wei Lan
committed Details | Review
configure: Don't declare functions in AC_TRY_COMPILE (gnome-3-24 branch) (880 bytes, patch)
2018-01-20 09:44 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2018-01-20 09:42:02 UTC
Please see the patch. Declaring functions in AC_TRY_COMPILE causes the test for -fvisibility=hidden to fail on Clang.

AC_TRY_COMPILE puts code to test in the main function, so instead of using 'int main (void) { return 0; }' as test program, we must use 'return 0' without declaring any function. If we declare main function there, it becomes a nested main function inside the global main function. It is supported by GCC, but not by Clang.

This causes problems when checking compiler flags:

checking for -fvisibility=hidden compiler flag... no
Comment 1 Ting-Wei Lan 2018-01-20 09:43:41 UTC
Created attachment 367141 [details] [review]
configure: Don't declare functions in AC_TRY_COMPILE (master branch)
Comment 2 Ting-Wei Lan 2018-01-20 09:44:01 UTC
Created attachment 367142 [details] [review]
configure: Don't declare functions in AC_TRY_COMPILE (gnome-3-24 branch)
Comment 3 Sébastien Wilmet 2018-01-20 15:22:30 UTC
Review of attachment 367141 [details] [review]:

After reading the Autoconf documentation for AC_TRY_COMPILE, it's not clear how the macro behaves. But it probably uses a macro similar to AC_LANG_PROGRAM, so your patch looks good.
Comment 4 Sébastien Wilmet 2018-01-20 15:22:58 UTC
Review of attachment 367142 [details] [review]:

Ditto.
Comment 5 Ting-Wei Lan 2018-01-20 15:50:12 UTC
Attachment 367141 [details] pushed as 5349b3d - configure: Don't declare functions in AC_TRY_COMPILE
Attachment 367142 [details] pushed as ee90812 - configure: Don't declare functions in AC_TRY_COMPILE
Comment 6 Sébastien Wilmet 2018-01-24 09:20:05 UTC
For the record, tested on Linux with GCC:
checking for -fvisibility=hidden compiler flag... yes

so it works fine.