Closed
Bug 702090
Opened 13 years ago
Closed 13 years ago
compilation error: pkcs11n.h:365:26: error: "__GNUC_MINOR" is not defined
Categories
(NSS :: Libraries, defect, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
3.13.2
People
(Reporter: chemobejk, Assigned: elio.maldonado.batiz)
References
Details
Attachments
(1 file)
966 bytes,
patch
|
KaiE
:
review+
|
Details | Diff | Splinter Review |
PROBLEM:
A pidgin-sipe user complained about compilation errors when he compiled it against NSS 3.13.1 on OpenSuse 11.4. Here are the important bits from the GCC command line:
gcc ... -Werror -Wall -Wextra -Waggre gate-return -Wcast-align -Wdeclaration-after-statement -Winit-self -Wmissing-dec larations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wundef ... -I/usr/include/nss3 -I/usr/include/nspr4 ... -c sipe-cert-crypto-nss.c
cc1: warnings being treated as errors
In file included from /usr/include/nss3/pkcs11t.h:1780:0,
from /usr/include/nss3/keythi.h:41,
from /usr/include/nss3/keyt.h:41,
from /usr/include/nss3/cert.h:55,
from sipe-cert-crypto-nss.c:29:
/usr/include/nss3/pkcs11n.h:365:26: error: "__GNUC_MINOR" is not defined
The same code compiles fine with NSS < 3.13.
ROOT CAUSE:
In 3.13.1 pkcs11n.h has this construct:
#if __GNUC__ > 3
...
#if (__GNUC__ == 4) && (__GNUC_MINOR < 5)
...
#else
which is clearly incorrect. It assumes __GNUC__ is defined, i.e. GCC, and __GNUC_MINOR is a typo.
PROPOSED FIX:
pkcs11n.h should have instead:
#if defined(__GNUC__) && (__GNUC__ > 3)
...
#if (__GNUC__ == 4) && (__GNUC_MINOR__ < 5)
...
#else
That should work with all compilers and fix the __GNUC_MINOR__ typo.
Reporter | ||
Comment 1•13 years ago
|
||
The problem was introduced in v1.22 with the fix for bug #642503.
See comment: https://bugzilla.mozilla.org/show_bug.cgi?id=642503#c20
Updated•13 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Hardware: x86_64 → All
Comment 2•13 years ago
|
||
Elio, this looks like the same issue you are dealing with.
The reason we don't trip over the undefines is we don't flip the flag to make undefined comparisons an error.
Also we currently only have built this with GCC 3.x or GCC 4.5 or greater. This patch will allow GCC 4.1, for instance, to work correctly.
bob
Updated•13 years ago
|
Assignee: nobody → emaldona
Status: NEW → ASSIGNED
Comment 3•13 years ago
|
||
Prepare a patch what comment 0 says.
Attachment #575453 -
Flags: review?(wtc)
Comment 4•13 years ago
|
||
Comment on attachment 575453 [details] [diff] [review]
fix
This is obviously correct. r=kaie
Attachment #575453 -
Flags: review?(wtc) → review+
Comment 5•13 years ago
|
||
checked in
Checking in pkcs11n.h;
/cvsroot/mozilla/security/nss/lib/util/pkcs11n.h,v <-- pkcs11n.h
new revision: 1.27; previous revision: 1.26
done
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
See Also: → https://launchpad.net/bugs/915069
Comment 6•13 years ago
|
||
The test
#if __GNUC__ > 3
is correct even if __GNUC__ is not defined. The C preprocessor
replaces an undefined macro with 0L in a conditional expression.
So if __GNUC__ is not defined, the test
#if __GNUC__ > 3
will fail, which is the expected result.
Priority: -- → P2
Target Milestone: --- → 3.13.2
Reporter | ||
Comment 7•13 years ago
|
||
(In reply to Wan-Teh Chang from comment #6)
> The test
> #if __GNUC__ > 3
> is correct even if __GNUC__ is not defined.
You are missing the point. Any non-GCC compiler that has the equivalent of GCCs "-Werror -Wundef" will not compile this statement. ARM RVCT would be one example.
You need to log in
before you can comment on or make changes to this bug.
Description
•