Bug #7383 innobase/include/rem0rec.ic fails to compile using the Compaq Compiler
Submitted: 17 Dec 2004 17:06 Modified: 18 Dec 2004 11:49
Reporter: Lenz Grimmer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:5.0.3-pre OS:Other (Tru64)
Assigned to: Marko Mäkelä CPU Architecture:Any

[17 Dec 2004 17:06] Lenz Grimmer
Description:
It's probably a very stupid compiler, but this is the error I get on Tru64 (Compaq C++ V6.5-042):

03527: cc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I./../../include -I../../include    -g  -DDBUG_ON -DSAFE_MUTEX -g -DDBUG_ON -DSAFE_MUTEX -O4 -pthread -ansi_alias -ansi_args -fast -inline speed -speculate all -DUNDEF_HAVE_GETHOSTBYNAME_R -DSNPRINTF_RETURN_TRUNC  -DUNIV_MUST_NOT_INLINE -c rem0rec.c
03528: cc: Info: File not optimized; use -g3 if both optimization and debug wanted. (suppressoptlvl)
03529: cc: Error: ./../include/rem0rec.ic, line 260: Missing ";". (nosemi)
03530: 		lint ret = (int16_t) rec_get_bit_field_2(rec, REC_NEXT,
03531: -------------------------------------^
03532: cc: Error: ./../include/rem0rec.ic, line 260: In the initializer for ret, "int16_t" is not declared. (undeclared)
03533: 		lint ret = (int16_t) rec_get_bit_field_2(rec, REC_NEXT,
03534: ----------------------------^
03535: gmake[4]: *** [rem0rec.o] Error 1
03536: gmake[4]: Leaving directory `/local/users/mysqldev/barney/mysql-5.0.3-alpha/innobase/rem'

How to repeat:
Try to compile the current 5.0 tree on the platform above.
[17 Dec 2004 22:53] Marko Mäkelä
Actually, I found the Digital C++ Compiler a very good compiler when I used it a few years ago. It's my mistake; I thought that int16_t would be defined through the headers included by InnoDB, but it's apparently only defined because of namespace pollution. On Digital UNIX, we could #include <inttypes.h>, but I'm afraid this header could be missing from some other platform.

Thus, I replaced the "int16_t" with "signed short", which hopefully is a signed 16-bit data type on all supported platform. The code assumes 2's complement arithmetics. The typecast aims for and sign extension of bit 15 to bit positions 16 and above. Lenz, can you please confirm that sizeof(short)==2 on all build platforms?
[18 Dec 2004 11:49] Heikki Tuuri
Lenz, Marko,

I just pushed a patch to 5.0 that avoids the use of short int or int16_t. It only uses the ordinary unsigned long int.

Thus, this bug is fixed now.

Regards,

Heikki