Closed Bug 335275 Opened 18 years ago Closed 18 years ago

Compile with the GCC flag -Werror-implicit-function-declaration

Categories

(NSS :: Build, enhancement)

3.11
x86
Linux
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(3 files, 1 obsolete file)

We should compile with the GCC flag -Werror-implcit-function-declaration
to make undeclared functions break the builds.  Undeclared functions
are easy to fix, and they are a source of 64-bit porting problems.  So
there is little reason not to fix them.

GCC documentation (http://gcc.gnu.org/onlinedocs/) shows that
-Werror-implcit-function-declaration is supported in GCC versions
as early as 2.95.3 (see
http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html#SEC8,
search for "-Werror-implicit-function-declaration").  So we should
be able to just add -Werror-implicit-function-declaration to
coreconf/Linux.mk.
Attachment #219625 - Flags: review?(julien.pierre.bugs)
Comment on attachment 219625 [details] [diff] [review]
Use -Werror-implicit-function-declaration on Linux and Solaris


>-	CCC       += -Wall -Wno-format
>+	CCC       += -Wall -Wno-format -Werror-implicit-function-declaration

I think calls to undeclared functions are always an error in c++, so this
particular option is probably a no-op, unless maybe it has an effect on c
code compiled with CCC.  

Anyway, I say, go for it.  If we have to tweak this change later, so be it.
I think the payback for this change will be immediate!  r=nelson
Attachment #219625 - Flags: review+
Nelson, you are right, C++ doesn't need that flag.

I checked in this patch on the NSS trunk (3.12) and
NSS_3_11_BRANCH (3.11.1).

Checking in Linux.mk;
/cvsroot/mozilla/security/coreconf/Linux.mk,v  <--  Linux.mk
new revision: 1.29; previous revision: 1.28
done
Checking in SunOS5.mk;
/cvsroot/mozilla/security/coreconf/SunOS5.mk,v  <--  SunOS5.mk
new revision: 1.22; previous revision: 1.21
done

Checking in Linux.mk;
/cvsroot/mozilla/security/coreconf/Linux.mk,v  <--  Linux.mk
new revision: 1.27.2.2; previous revision: 1.27.2.1
done
Checking in SunOS5.mk;
/cvsroot/mozilla/security/coreconf/SunOS5.mk,v  <--  SunOS5.mk
new revision: 1.21.2.1; previous revision: 1.21
done
Attachment #219625 - Attachment is obsolete: true
Attachment #219625 - Flags: review?(julien.pierre.bugs)
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.11.1
We might as well use this bug to record all the places we will soon find 
with calls to undeclared functions.
Attachment #219654 - Flags: superreview?(wtchang)
Attachment #219654 - Flags: review?
Attachment #219654 - Flags: review? → review?(douglas)
Comment on attachment 219654 [details] [diff] [review]
patch for undeclared printf call in ecl libs, removes call.

r=wtc.  The code should be removed rather than
being commented out with #if 0.
Attachment #219654 - Flags: superreview?(wtchang) → superreview+
The PK11_PQG_ functions are declared in pk11pqg.h.
They operate on the PQGParams type.  But we call
PK11_GetPQGParamsFromPrivateKey to create a
SECKEYPQGParams structure, which is isomorphic to
PQGParams.  So I also have to change the type of
pqgParams and add a typecast.
Attachment #219696 - Flags: review?(nelson)
Comment on attachment 219696 [details] [diff] [review]
patch for PK11PrivKey.c in JSS

I suspect there may be some #includes that are no longer necessary, but we don't have to fix that now.
Attachment #219696 - Flags: review?(nelson) → review+
I checked in the JSS patch on the JSS trunk.

Checking in PK11PrivKey.c;
/cvsroot/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11PrivKey.c,v  <--  PK11P
rivKey.c
new revision: 1.16; previous revision: 1.15
done

Since I don't know which JSS branch is used with NSS_3_11_BRANCH
at Sun, I backed out my -Werror-implicit-function-declaration patch
from NSS_3_11_BRANCH.

Checking in Linux.mk;
/cvsroot/mozilla/security/coreconf/Linux.mk,v  <--  Linux.mk
new revision: 1.27.2.3; previous revision: 1.27.2.2
done
Checking in SunOS5.mk;
/cvsroot/mozilla/security/coreconf/SunOS5.mk,v  <--  SunOS5.mk
new revision: 1.21.2.2; previous revision: 1.21.2.1
done
Target Milestone: 3.11.1 → 3.12
Attachment #219654 - Flags: review?(douglas) → review+
Assignee: nobody → wtchang
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: