Browse Source

- gcc 4.0 support (optimizations)
- gcc 4.0 warning i& compile fixes
- postgres bug & warning fixes

Andrei Pelinescu-Onciul 20 years ago
parent
commit
7cdc2add4e
6 changed files with 77 additions and 4 deletions
  1. 67 3
      Makefile.defs
  2. 3 0
      msg_translator.c
  3. 2 0
      parser/parse_methods.c
  4. 2 1
      parser/parse_to.c
  5. 2 0
      parser/parse_uri.c
  6. 1 0
      parser/parse_via.c

+ 67 - 3
Makefile.defs

@@ -40,6 +40,7 @@
 #  2005-04-27  alpha support added (andrei)
 #  2005-06-01  use $(LOCALBASE) instead of /usr/{local,pkg} (andrei)
 #  2005-06-06  ppc64 support & missing ppc optimizations section added (andrei)
+#  2005-07-06  gcc 4.0 optimizations support (andrei)
 
 
 # check if already included/exported
@@ -55,8 +56,8 @@ MAIN_NAME=ser
 #version number
 VERSION = 0
 PATCHLEVEL = 9
-SUBLEVEL = 3
-EXTRAVERSION = 
+SUBLEVEL = 4
+EXTRAVERSION = -rc1
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
@@ -189,7 +190,8 @@ ifneq (,$(findstring gcc, $(CC_LONGVER)))
 				 sed -e 's/[^0-9]*-\(.*\)/\1/'| \
 				 sed -e 's/2\.9.*/2.9x/' -e 's/3\.[0-3]\..*/3.0/' -e \
 				 	's/3\.[0-3]/3.0/' -e 's/3\.[4-9]\..*/3.4/' -e \
-					's/3\.[4-9]/3.4/' )
+					's/3\.[4-9]/3.4/' -e 's/4\.[0-9]\..*/4.x/' -e \
+					's/4\.[0-9]/4.x/' )
 endif
 
 ifneq (, $(findstring Sun, $(CC_LONGVER)))
@@ -455,6 +457,14 @@ ifeq		($(CC_NAME), gcc)
 				#common stuff
 				CFLAGS=-g -O9 -funroll-loops  -Wcast-align $(PROFILE) \
 					-Wall  
+			#if gcc 4.0+
+ifeq			($(CC_SHORTVER), 4.x)
+					CPU ?= athlon64
+					CFLAGS+=-minline-all-stringops -malign-double \
+							-falign-loops \
+							-ftree-vectorize \
+							-mtune=$(CPU) 
+else
 			#if gcc 3.4+
 ifeq			($(CC_SHORTVER), 3.4)
 					CPU ?= athlon
@@ -483,6 +493,7 @@ $(warning			You are using an old and unsupported gcc \
 endif			# CC_SHORTVER, 2.9x
 endif			# CC_SHORTVER, 3.0
 endif			# CC_SHORTVER, 3.4
+endif			# CC_SHORTVER, 4.x
 
 else		# CC_NAME, gcc
 ifeq		($(CC_NAME), icc)
@@ -506,6 +517,14 @@ ifeq		($(CC_NAME), gcc)
 				#common stuff
 				CFLAGS=-g -O9 -funroll-loops  -Wcast-align $(PROFILE) \
 					-Wall 
+			#if gcc 4.0+
+ifeq			($(CC_SHORTVER), 4.x)
+					CPU ?= opteron
+					CFLAGS+=-minline-all-stringops \
+							-falign-loops \
+							-ftree-vectorize \
+							-mtune=$(CPU) 
+else
 			#if gcc 3.4
 ifeq			($(CC_SHORTVER), 3.4)
 					CPU ?= athlon64
@@ -534,6 +553,7 @@ $(warning			You are using an old and unsupported gcc \
 endif			# CC_SHORTVER, 2.9x
 endif			# CC_SHORTVER, 3.0
 endif			# CC_SHORTVER, 3.4
+endif			# CC_SHORTVER, 4.x
 
 else		# CC_NAME, gcc
 ifeq		($(CC_NAME), icc)
@@ -559,6 +579,14 @@ ifeq		($(CC_NAME), gcc)
 					-Wall\
 					#-Wcast-align \
 					#-Wmissing-prototypes 
+				#if gcc 4.x
+ifeq			($(CC_SHORTVER), 4.x)
+					CPU ?= ultrasparc
+					#use 32bit for now
+					CFLAGS+=-mcpu=ultrasparc -minline-all-stringops \
+							-mtune=$(CPU) \
+							-ftree-vectorize
+else
 				#if gcc 3.4
 ifeq			($(CC_SHORTVER), 3.4)
 					CPU ?= ultrasparc
@@ -602,6 +630,7 @@ endif
 endif			#CC_SHORTVER, 2.9x
 endif			#CC_SHORTVER, 3.0
 endif			#CC_SHORTVER, 3.4
+endif			#CC_SHORTVER, 4.x
 
 else		#CC_NAME, gcc
 ifeq		($(CC_NAME), suncc)
@@ -622,6 +651,11 @@ ifeq		($(CC_NAME), gcc)
 				#common stuff
 				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) \
 					-Wall   
+			#if gcc 4.x+
+ifeq			($(CC_SHORTVER), 4.x)
+					CFLAGS+=-mcpu=strongarm1100 -minline-all-stringops \
+							-ftree-vectorize
+else
 			#if gcc 3.4+
 ifeq			($(CC_SHORTVER), 3.4)
 					CFLAGS+= -mcpu=strongarm1100
@@ -644,6 +678,7 @@ $(warning			You are using an old and unsupported gcc \
 endif			# CC_SHORTVER, 2.9x
 endif			# CC_SHORTVER, 3.0
 endif			# CC_SHORTVER, 3.4
+endif			# CC_SHORTVER, 4.0
 	
 else		# CC_NAME, gcc
 				#other compilers
@@ -658,6 +693,11 @@ ifeq		($(CC_NAME), gcc)
 				#common stuff
 				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) \
 					-Wall 
+			#if gcc 4.0+
+ifeq			($(CC_SHORTVER), 4.x)
+					CFLAGS+=-mcpu=r3000 -minline-all-stringops \
+							-ftree-vectorize
+else
 			#if gcc 3.4+
 ifeq			($(CC_SHORTVER), 3.4)
 					CFLAGS+= -mcpu=r3000
@@ -680,6 +720,7 @@ $(warning			You are using an old and unsupported gcc \
 endif			# CC_SHORTVER, 2.9x
 endif			# CC_SHORTVER, 3.0
 endif			# CC_SHORTVER, 3.4
+endif			# CC_SHORTVER, 4.x
 	
 else		# CC_NAME, gcc
 				#other compilers
@@ -694,6 +735,10 @@ ifeq		($(CC_NAME), gcc)
 				#common stuff
 				CFLAGS= -mips2 -O9 -funroll-loops $(PROFILE) \
 					-Wall 
+			#if gcc 4.0+
+ifeq			($(CC_SHORTVER), 4.x)
+					CFLAGS+=-minline-all-stringops -ftree-vectorize
+else
 			#if gcc 3.4+
 ifeq			($(CC_SHORTVER), 3.4)
 					CFLAGS+=
@@ -714,6 +759,7 @@ $(warning			You are using an old and unsupported gcc \
 endif			# CC_SHORTVER, 2.9x
 endif			# CC_SHORTVER, 3.0
 endif			# CC_SHORTVER, 3.4
+endif			# CC_SHORTVER, 4.x
 	
 else		# CC_NAME, gcc
 				#other compilers
@@ -728,6 +774,10 @@ ifeq	($(ARCH), alpha)
 ifeq		($(CC_NAME), gcc)
 				#common stuff
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
+			#if gcc 4.0+
+ifeq			($(CC_SHORTVER), 4.x)
+					CFLAGS+=-minline-all-stringops
+else
 			#if gcc 3.4+
 ifeq			($(CC_SHORTVER), 3.4)
 					CFLAGS+=
@@ -748,6 +798,7 @@ $(warning			You are using an old and unsupported gcc \
 endif			# CC_SHORTVER, 2.9x
 endif			# CC_SHORTVER, 3.0
 endif			# CC_SHORTVER, 3.4
+endif			# CC_SHORTVER, 4.x
 	
 else		# CC_NAME, gcc
 				#other compilers
@@ -761,6 +812,12 @@ ifeq	($(ARCH), ppc)
 ifeq		($(CC_NAME), gcc)
 				#common stuff
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
+			#if gcc 4.0+
+ifeq			($(CC_SHORTVER), 4.x)
+					CPU ?= powerpc
+					CFLAGS+=-minline-all-stringops  -ftree-vectorize \
+							-mtune=$(CPU) -maltivec
+else
 			#if gcc 3.4+
 ifeq			($(CC_SHORTVER), 3.4)
 					CFLAGS+=
@@ -781,6 +838,7 @@ $(warning			You are using an old and unsupported gcc \
 endif			# CC_SHORTVER, 2.9x
 endif			# CC_SHORTVER, 3.0
 endif			# CC_SHORTVER, 3.4
+endif			# CC_SHORTVER, 4.x
 	
 else		# CC_NAME, gcc
 				#other compilers
@@ -794,6 +852,11 @@ ifeq	($(ARCH), ppc64)
 ifeq		($(CC_NAME), gcc)
 				#common stuff
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
+ifeq			($(CC_SHORTVER), 4.x)
+					CPU ?= powerpc64
+					CFLAGS+=-minline-all-stringops  -ftree-vectorize \
+							-mtune=$(CPU) -maltivec
+else
 			#if gcc 3.4+
 ifeq			($(CC_SHORTVER), 3.4)
 					CFLAGS+=
@@ -814,6 +877,7 @@ $(warning			You are using an old and unsupported gcc \
 endif			# CC_SHORTVER, 2.9x
 endif			# CC_SHORTVER, 3.0
 endif			# CC_SHORTVER, 3.4
+endif			# CC_SHORTVER, 4.x
 	
 else		# CC_NAME, gcc
 				#other compilers

+ 3 - 0
msg_translator.c

@@ -1605,6 +1605,9 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
 	received_len=rport_len=warning_len=content_len_len=0;
 	
 	text_len=strlen(text);
+
+	to_tag.s=0;  /* fixes gcc 4.0 warning */
+	to_tag.len=0;
 	
 	/* force parsing all headers -- we want to return all
 	Via's in the reply and they may be scattered down to the

+ 2 - 0
parser/parse_methods.c

@@ -227,6 +227,8 @@ static int parse_method(str* _next, unsigned int* _method)
  {
  	str next;
  	unsigned int method;
+	
+	method=0; /* fixes silly gcc 4.x warning */
  
 	if (!_body || !_methods) {
 		LOG(L_ERR, "parse_methods: Invalid parameter value\n");

+ 2 - 1
parser/parse_to.c

@@ -496,7 +496,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
 	int status;
 	int saved_status;
 	char  *tmp,*foo;
-
+	
+	saved_status=START_TO; /* fixes gcc 4.x warning */
 	status=START_TO;
 	to_b->error=PARSE_OK;
 	to_b->uri.len = 0;

+ 2 - 0
parser/parse_uri.c

@@ -312,6 +312,8 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
 	b=v=0;
 	param=param_val=0;
 	pass=0;
+	password.s=0; /* fixes gcc 4.0 warning */
+	password.len=0;
 	port_no=0;
 	state=URI_INIT;
 	memset(uri, 0, sizeof(struct sip_uri)); /* zero it all, just to be sure*/

+ 1 - 0
parser/parse_via.c

@@ -1011,6 +1011,7 @@ parse_again:
 	vb->error=PARSE_ERROR;
 	/* parse start of via ( SIP/2.0/UDP    )*/
 	state=F_SIP;
+	saved_state=F_SIP; /* fixes gcc 4.0 warning */
 	param_start=0;
 	for(tmp=buffer;tmp<end;tmp++){
 		switch(*tmp){