Last Comment Bug 478563 - Add _MSC_VER (the cl version) to coreconf.
: Add _MSC_VER (the cl version) to coreconf.
Status: RESOLVED FIXED
:
Product: NSS
Classification: Components
Component: Build (show other bugs)
: trunk
: x86 Windows XP
: P2 enhancement (vote)
: 3.12.3
Assigned To: Wan-Teh Chang
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-14 10:14 PST by Wan-Teh Chang
Modified: 2009-03-31 18:16 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Work in progress (2.23 KB, patch)
2009-02-14 10:14 PST, Wan-Teh Chang
no flags Details | Diff | Review
Patch v2 - brought forward to tip, incorporating suggested changes (1.25 KB, patch)
2009-03-30 11:52 PDT, Nelson Bolyard (seldom reads bugmail)
wtc: superreview+
Details | Diff | Review
patch - don't use -weNNNN with MSVC6 (checked in) (781 bytes, patch)
2009-03-31 17:44 PDT, Nelson Bolyard (seldom reads bugmail)
julien.pierre: review+
Details | Diff | Review

Description Wan-Teh Chang 2009-02-14 10:14:47 PST
Created attachment 362412 [details] [diff] [review]
Work in progress

We should define the make variable _MSC_VER as
the cl version in coreconf so that we can use it
to enable or disable cl features that only exist
in certain versions of cl.

This patch is work in progress.  Note that I
name the variable _MSC_VER (used in mozilla/configure.in)
rather than MSC_VER (used in mozilla/nsprpub/configure.in)
because I'd like to try to align with mozilla's build
system to make future maintenance easier.  Also
note that I don't define the variables _CC_MAJOR_VERSION
and _CC_MINOR_VERSION because I think they're just
intermediate variables, and we can save one shell call
by defining _MSC_VER directly with one shell call.

Finally, I don't escape the '.' in "awk -F." because '.'
is not a special character in shell.  '.' only needs to
be escaped in a regular expression.

I turn off -PDB:NONE if _MSC_VER != 1200 (VC++ 6.0).
Ideally the test should be _MSC_VER <= 1200, but it's
cumbersome to implement <= in makefiles.  As long as
none of us is using MSVC 5.0, the simple ifneq test
is sufficient.
Comment 1 Wan-Teh Chang 2009-02-14 10:25:16 PST
My last paragraph has some errors.  It should read:

  I turn on -PDB:NONE if _MSC_VER == 1200 (VC++ 6.0).
  Ideally the test should be _MSC_VER <= 1200, but it's
  cumbersome to implement <= in makefiles.  As long as
  none of us is using MSVC 5.0, the simple ifeq test
  is sufficient.
Comment 2 Nelson Bolyard (seldom reads bugmail) 2009-02-14 11:28:50 PST
This can be further consolidated into a single $(shell command, e.g. 

+_MSC_VER    := $(shell $(CC) -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||' | awk -F. '{ print $$1$$2 }')
Comment 3 Kaspar Brand 2009-02-15 02:41:19 PST
Wan-Teh, what about saving some pipes in the shell call as well...? Like so:

_MSC_VER    := $(shell $(CC) 2>&1 | sed -ne 's/.* Version \([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*/\1\2/p')
Comment 4 Nelson Bolyard (seldom reads bugmail) 2009-02-15 03:38:14 PST
Kaspar inspired me.  :)

_MSC_VER := $(shell $(CC) 2>&1 | sed -ne \
's/.*[^0-9.]\([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*/\1\2/p')
Comment 5 Nelson Bolyard (seldom reads bugmail) 2009-03-30 11:52:29 PDT
Created attachment 370043 [details] [diff] [review]
Patch v2 - brought forward to tip, incorporating suggested changes

Julien, please see the preceding comments in this bug before reviewing.
Thanks.
Comment 6 Wan-Teh Chang 2009-03-30 12:54:32 PDT
Comment on attachment 370043 [details] [diff] [review]
Patch v2 - brought forward to tip, incorporating suggested changes

r=wtc.

> 	BSDECHO      = echo
> 	RC           = rc.exe
> 	MT           = mt.exe
>+	# Determine compiler version
>+	_MSC_VER_6   = 1200	# MSVC 6
>+	_MSC_VER := $(shell $(CC) 2>&1 | sed -ne \
>+		's/.*[^0-9.]\([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*/\1\2/p' )

Nit: you may want to align := with the ='s above.
Comment 7 Nelson Bolyard (seldom reads bugmail) 2009-03-30 13:33:23 PDT
Thanks, Wan-Teh.  I cleaned up that alignment.
Checking in WIN32.mk; new revision: 1.35; previous revision: 1.34
Comment 8 Julien Pierre 2009-03-30 19:46:09 PDT
Note that the VC6 build is broken on the trunk in freebl, even after that checkin, in the following way :

/WINNT_SINGLE_SHLIB/ -Od -W3 -nologo -D_CRT_SECURE_NO_WARNINGS -MD -we4002 -we40
03 -we4004 -we4006 -we4009 -we4013 -we4015 -we4028 -we4033 -we4035 -we4045 -we40
47 -we4053 -we4054 -we4063 -we4064 -we4078 -we4087 -we4098 -we4390 -we4551 -we45
53 -we4715 -GT -DXP_PC -DSHLIB_SUFFIX=\"dll\" -DSHLIB_PREFIX=\"\" -DSHLIB_VERSIO
N=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -DDEBUG -D_DEBU
G -UNDEBUG -DDEBUG_Administrator -DWIN32 -D_X86_ -D_WINDOWS -DWINNT -DNSS_ENABLE
_ECC -DNSS_ECC_MORE_THAN_SUITE_B -DUSE_UTIL_DIRECTLY -D_X86_ -DMP_ASSEMBLY_MULTI
PLY -DMP_ASSEMBLY_SQUARE  -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT -DMP_NO_MP
_WORD -DMP_API_COMPATIBLE -I../../../../dist/WINNT5.2_DBG.OBJ/include -I../../..
/../dist/public/nss -I../../../../dist/private/nss -Impi -Iecl  /c/NSS/tip/mozil
la/security/nss/lib/freebl/sysrand.c
Command line warning D4002 : ignoring unknown option '-we4002'
Command line warning D4002 : ignoring unknown option '-we4003'
Command line warning D4002 : ignoring unknown option '-we4004'
Command line warning D4002 : ignoring unknown option '-we4006'
Command line warning D4002 : ignoring unknown option '-we4009'
Command line warning D4002 : ignoring unknown option '-we4013'
Command line warning D4002 : ignoring unknown option '-we4015'
Command line warning D4002 : ignoring unknown option '-we4028'
Command line warning D4002 : ignoring unknown option '-we4033'
Command line warning D4002 : ignoring unknown option '-we4035'
Command line warning D4002 : ignoring unknown option '-we4045'
Command line warning D4002 : ignoring unknown option '-we4047'
Command line warning D4002 : ignoring unknown option '-we4053'
Command line warning D4002 : ignoring unknown option '-we4054'
Command line warning D4002 : ignoring unknown option '-we4063'
Command line warning D4002 : ignoring unknown option '-we4064'
Command line warning D4002 : ignoring unknown option '-we4078'
Command line warning D4002 : ignoring unknown option '-we4087'
Command line warning D4002 : ignoring unknown option '-we4098'
Command line warning D4002 : ignoring unknown option '-we4390'
Command line warning D4002 : ignoring unknown option '-we4551'
Command line warning D4002 : ignoring unknown option '-we4553'
Command line warning D4002 : ignoring unknown option '-we4715'
sysrand.c
c:/NSS/tip/mozilla/security/nss/lib/freebl/win_rand.c(194) : error C2065: 'CSIDL
_COMPUTERSNEARME' : undeclared identifier
c:/NSS/tip/mozilla/security/nss/lib/freebl/win_rand.c(194) : error C2099: initia
lizer is not a constant
make[1]: *** [WINNT5.2_DBG.OBJ/WINNT_SINGLE_SHLIB/sysrand.obj] Error 2
make[1]: Leaving directory `/c/NSS/tip/mozilla/security/nss/lib/freebl'
make: *** [libs] Error 2

The 3.11 branch still builds .
Comment 9 Julien Pierre 2009-03-30 19:48:47 PDT
Comment on attachment 370043 [details] [diff] [review]
Patch v2 - brought forward to tip, incorporating suggested changes

Already checked in, cancelling review. This looks fine, but the tip VC6 build is broken in the first place, I don't know if we should bother with _MSC_VER_6.

We could use the _MSC_VER in the future to deal with other incompatibilities in new releases of MSVC.
Comment 10 Nelson Bolyard (seldom reads bugmail) 2009-03-31 17:44:06 PDT
Created attachment 370329 [details] [diff] [review]
patch - don't use -weNNNN with MSVC6 (checked in)

This patch addresses one of Julien's observations.
Julien, please review.
Comment 11 Nelson Bolyard (seldom reads bugmail) 2009-03-31 17:47:53 PDT
The problem reported in the MSVC6 build with the error message:

> win_rand.c(194): error C2065: 'CSIDL_COMPUTERSNEARME': undeclared identifier

Isn't really an issue with the compiler version.  It's an issue with the 
header files.  The solution is to use header files from a newer Microsoft
"Platform SDK" with the older compiler.
Comment 12 Nelson Bolyard (seldom reads bugmail) 2009-03-31 17:50:26 PDT
Comment on attachment 370329 [details] [diff] [review]
patch - don't use -weNNNN with MSVC6 (checked in)

Checking in WIN32.mk; new revision: 1.36; previous revision: 1.35
Comment 13 Julien Pierre 2009-03-31 17:56:55 PDT
Nelson,

With the same VC6 build environment, the NSS_3_11_BRANCH builds, but the trunk build fails, so it can't just be the platform SDK .
Comment 14 Nelson Bolyard (seldom reads bugmail) 2009-03-31 18:12:32 PDT
Julien, do you see the symbol CSIDL_COMPUTERSNEARME in the 3.11 branch code?
Comment 15 Julien Pierre 2009-03-31 18:16:43 PDT
No. Hmm, I think I need to get more sleep, because I had checked that yesterday and I thought that code existed in both the branch and trunk. I guess I should be able to fix this in my VC6 environment in this case by pointing to the Windows 2003 SDK.

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