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 902693 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.
define gcc--Wparentheses-friendly assert macro
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 22:24:11 UTC
(
hide
)
Description:
define gcc--Wparentheses-friendly assert macro
Filename:
MIME Type:
Creator:
Jim Meyering
Created:
2014-06-05 22:24:11 UTC
Size:
1.83 KB
patch
obsolete
>From fd1af80531d659ee11a902dd434bfdc6314291ba 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..10cdc9e 100644 >--- a/ChangeLog >+++ b/ChangeLog >@@ -1,3 +1,12 @@ >+2014-06-05 Jim Meyering <meyering@fb.com> >+ >+ [BZ # FIXME] >+ * 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..d683051 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)) >+ do { \ >+ if (expr) \ >+ ; /* empty */ \ >+ else \ >+ __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION); \ >+ } while (0) > > # 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