Last Comment Bug 335275 - Compile with the GCC flag -Werror-implicit-function-declaration
: Compile with the GCC flag -Werror-implicit-function-declaration
Status: RESOLVED FIXED
:
Product: NSS
Classification: Components
Component: Build (show other bugs)
: 3.11
: x86 Linux
: -- enhancement (vote)
: 3.12
Assigned To: Wan-Teh Chang
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-24 11:03 PDT by Wan-Teh Chang
Modified: 2006-05-18 02:45 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Use -Werror-implicit-function-declaration on Linux and Solaris (1.48 KB, patch)
2006-04-24 11:36 PDT, Wan-Teh Chang
nelson: review+
Details | Diff | Splinter Review
Use -Werror-implicit-function-declaration on Linux and Solaris (as checked in) (1.35 KB, patch)
2006-04-24 13:51 PDT, Wan-Teh Chang
no flags Details | Diff | Splinter Review
patch for undeclared printf call in ecl libs, removes call. (658 bytes, patch)
2006-04-24 14:09 PDT, Nelson Bolyard (seldom reads bugmail)
douglas: review+
wtc: superreview+
Details | Diff | Splinter Review
patch for PK11PrivKey.c in JSS (1.05 KB, patch)
2006-04-24 18:00 PDT, Wan-Teh Chang
nelson: review+
Details | Diff | Splinter Review

Description Wan-Teh Chang 2006-04-24 11:03:06 PDT
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.
Comment 1 Wan-Teh Chang 2006-04-24 11:36:00 PDT
Created attachment 219625 [details] [diff] [review]
Use -Werror-implicit-function-declaration on Linux and Solaris
Comment 2 Nelson Bolyard (seldom reads bugmail) 2006-04-24 11:58:08 PDT
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
Comment 3 Wan-Teh Chang 2006-04-24 13:51:00 PDT
Created attachment 219650 [details] [diff] [review]
Use -Werror-implicit-function-declaration on Linux and Solaris (as checked in)

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
Comment 4 Nelson Bolyard (seldom reads bugmail) 2006-04-24 14:09:25 PDT
Created attachment 219654 [details] [diff] [review]
patch for undeclared printf call in ecl libs, removes call.

We might as well use this bug to record all the places we will soon find 
with calls to undeclared functions.
Comment 5 Wan-Teh Chang 2006-04-24 14:22:15 PDT
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.
Comment 6 Wan-Teh Chang 2006-04-24 18:00:40 PDT
Created attachment 219696 [details] [diff] [review]
patch for PK11PrivKey.c in JSS

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.
Comment 7 Nelson Bolyard (seldom reads bugmail) 2006-04-24 18:19:42 PDT
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.
Comment 8 Wan-Teh Chang 2006-04-24 18:33:07 PDT
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

Note You need to log in before you can comment on or make changes to this bug.