Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 902724 Details for
Bug 1105335
assert (errno = ENOENT) cannot be detected by gcc -Wparentheses
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
adjusted to use statement expression instead of do...while(0)
0001-assert.h-allow-gcc-to-detect-assert-a-1-errors.patch (text/plain), 1.83 KB, created by
Jim Meyering
on 2014-06-05 23:45:39 UTC
(
hide
)
Description:
adjusted to use statement expression instead of do...while(0)
Filename:
MIME Type:
Creator:
Jim Meyering
Created:
2014-06-05 23:45:39 UTC
Size:
1.83 KB
patch
obsolete
>From 46abd5c9f7e90bd434f4d20330433812be8e2202 Mon Sep 17 00:00:00 2001 >From: Jim Meyering <meyering@fb.com> >Date: Thu, 5 Jun 2014 10:42:05 -0700 >Subject: [PATCH] assert.h: allow gcc to detect assert(a = 1) errors > >* assert/assert.h (assert): Rewrite assert's definition so that >a s/==/=/ typo, e.g., assert(errno = ENOENT) is not hidden from >gcc's -Wparentheses by the parentheses added by assert. >The new definition uses "if (expr) ; else __assert_fail...", so >gcc -Wall will now detect that type of error in an assert, too. >--- > ChangeLog | 9 +++++++++ > assert/assert.h | 9 ++++++--- > 2 files changed, 15 insertions(+), 3 deletions(-) > >diff --git a/ChangeLog b/ChangeLog >index 17f0c83..ed58f9f 100644 >--- a/ChangeLog >+++ b/ChangeLog >@@ -1,3 +1,12 @@ >+2014-06-05 Jim Meyering <meyering@fb.com> >+ >+ [BZ # 1105335] >+ * assert/assert.h (assert): Rewrite assert's definition so that >+ a s/==/=/ typo, e.g., assert(errno = ENOENT) is not hidden from >+ gcc's -Wparentheses by the parentheses added by assert. >+ The new definition uses "if (expr) ; else __assert_fail...", so >+ gcc -Wall will now detect that type of error in an assert, too. >+ > 2014-06-05 OndÅej BÃlka <neleai@seznam.cz> > > [BZ #15698] >diff --git a/assert/assert.h b/assert/assert.h >index 2661391..2b07f68 100644 >--- a/assert/assert.h >+++ b/assert/assert.h >@@ -83,9 +83,12 @@ extern void __assert (const char *__assertion, const char *__file, int __line) > __END_DECLS > > # define assert(expr) \ >- ((expr) \ >- ? __ASSERT_VOID_CAST (0) \ >- : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION)) >+ ({ \ >+ if (expr) \ >+ ; /* empty */ \ >+ else \ >+ __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION); \ >+ }) > > # ifdef __USE_GNU > # define assert_perror(errnum) \ >-- >1.9.0.rc3.9.ge265f1f >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1105335
:
902693
|
902724
|
914882
|
918486
|
918491
|
918554
|
1223507