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 792713 - [PATCH] Don't put #include "stdio.h" inside the main function
[PATCH] Don't put #include "stdio.h" inside the main function
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: General
git master
Other FreeBSD
: Normal normal
: ---
Assigned To: tracker-general
tracker-general
Depends on:
Blocks:
 
 
Reported: 2018-01-20 09:10 UTC by Ting-Wei Lan
Modified: 2018-01-27 09:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
configure: Don't put includes in function body of AC_LANG_PROGRAM (tracker) (1012 bytes, patch)
2018-01-20 09:11 UTC, Ting-Wei Lan
committed Details | Review
configure: Don't put includes in function body of AC_LANG_PROGRAM (tracker-miners) (1012 bytes, patch)
2018-01-20 09:14 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2018-01-20 09:10:16 UTC
Please see tha patch. Putting includes in the second argument of AC_LANG_PROGRAM causes headers to be included inside the main function. This fails on compilers not supporting nested functions because stdio.h may have definitions of inline functions.

clang: error: function definition is not allowed here
Comment 1 Ting-Wei Lan 2018-01-20 09:11:03 UTC
Created attachment 367135 [details] [review]
configure: Don't put includes in function body of AC_LANG_PROGRAM (tracker)

The second argument of AC_LANG_PROGRAM is the content of main function.
We cannot put any includes there, or we end up testing whether the
compiler supports nested functions because headers may have definitions
for inline functions.
Comment 2 Ting-Wei Lan 2018-01-20 09:14:07 UTC
Created attachment 367136 [details] [review]
configure: Don't put includes in function body of AC_LANG_PROGRAM (tracker-miners)

The second argument of AC_LANG_PROGRAM is the content of main function.
We cannot put any includes there, or we end up testing whether the
compiler supports nested functions because headers may have definitions
for inline functions.
Comment 3 Carlos Garnacho 2018-01-26 23:18:19 UTC
Comment on attachment 367135 [details] [review]
configure: Don't put includes in function body of AC_LANG_PROGRAM (tracker)

Right.
Comment 4 Carlos Garnacho 2018-01-26 23:19:14 UTC
Comment on attachment 367136 [details] [review]
configure: Don't put includes in function body of AC_LANG_PROGRAM (tracker-miners)

This one too.
Comment 5 Carlos Garnacho 2018-01-26 23:20:36 UTC
Thanks for the patches! Feel free to push :).
Comment 6 Ting-Wei Lan 2018-01-27 08:58:25 UTC
Comment on attachment 367135 [details] [review]
configure: Don't put includes in function body of AC_LANG_PROGRAM (tracker)

Attachment 367135 [details] pushed as 2d5fb36 - configure: Don't put includes in function body of AC_LANG_PROGRAM
Comment 7 Ting-Wei Lan 2018-01-27 08:59:58 UTC
Attachment 367136 [details] pushed as b70291d - configure: Don't put includes in function body of AC_LANG_PROGRAM