This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/21242] New: assert gives pedantic warning in old gcc versions
- From: "jzb0012 at auburn dot edu" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 13 Mar 2017 03:33:39 +0000
- Subject: [Bug libc/21242] New: assert gives pedantic warning in old gcc versions
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=21242
Bug ID: 21242
Summary: assert gives pedantic warning in old gcc versions
Product: glibc
Version: 2.25
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: jzb0012 at auburn dot edu
CC: drepper.fsp at gmail dot com
Target Milestone: ---
Created attachment 9892
--> https://sourceware.org/bugzilla/attachment.cgi?id=9892&action=edit
patch
The braced-group version of the assert macro introduced in commit e077349ce589
causes a warning in old versions of `gcc -pedantic` (without -ansi). This
warning also occurs in the latest clang. Patch attached.
main.c:
#include <assert.h>
int main() { assert(1); }
Without patched assert.h:
$ gcc-4.8 -pedantic main.c
$ gcc-4.4 -pedantic main.c
main.c: In function ‘main’:
main.c:2: warning: ISO C forbids braced-groups within expressions
$ clang-3.9 -pedantic main.c
main.c:2:14: warning: use of GNU statement expression extension
[-Wgnu-statement-expression]
int main() { assert(1); }
^
/usr/include/assert.h:95:6: note: expanded from macro 'assert'
({ \
^
1 warning generated.
With patched assert.h:
$ gcc-4.8 -pedantic main.c
$ gcc-4.4 -pedantic main.c
$ clang-3.9 -pedantic main.c
--
You are receiving this mail because:
You are on the CC list for the bug.