瀏覽代碼

- gcc 4.0 support (optimizations)
- various warnings fixes/workarrounds for gcc-4.0

Andrei Pelinescu-Onciul 20 年之前
父節點
當前提交
e0931fb0a1
共有 7 個文件被更改,包括 75 次插入10 次删除
  1. 65 1
      Makefile.defs
  2. 0 8
      io_wait.h
  3. 3 0
      msg_translator.c
  4. 2 0
      parser/parse_methods.c
  5. 2 1
      parser/parse_to.c
  6. 2 0
      parser/parse_uri.c
  7. 1 0
      parser/parse_via.c

+ 65 - 1
Makefile.defs

@@ -41,6 +41,7 @@
 #  2005-06-01  use $(LOCALBASE) instead of /usr/{local,pkg} (andrei)
 #  2005-06-26  numeric OSREL & HAVE_KQUEUE added to the *BSD (andrei)
 #  2005-07-04  HAVE_DEVPOLL added to solaris (andrei)
+#  2005-07-06  gcc 4.0 optimizations support (andrei)
 
 
 # check if already included/exported
@@ -197,7 +198,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)))
@@ -463,6 +465,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
@@ -491,6 +501,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)
@@ -514,6 +525,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
@@ -542,6 +561,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)
@@ -567,6 +587,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
@@ -610,6 +638,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)
@@ -630,6 +659,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
@@ -652,6 +686,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
@@ -666,6 +701,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
@@ -688,6 +728,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
@@ -702,6 +743,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+=
@@ -722,6 +767,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
@@ -736,6 +782,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+=
@@ -756,6 +806,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
@@ -769,6 +820,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+=
@@ -789,6 +846,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
@@ -802,6 +860,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+=
@@ -822,6 +885,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

+ 0 - 8
io_wait.h

@@ -188,14 +188,6 @@ static inline struct fd_map* hash_fd_map(	io_wait_h* h,
 }
 
 
-#ifdef HAVE_SIGIO_RT
-typedef unsigned int sigio_rtsig_mask_t;
-extern sigset_t _sigio_rtsig_used;
-extern int _sigio_crt_rtsig;
-extern int _sigio_init;
-#endif
-
-
 
 #ifdef HANDLE_IO_INLINE
 /* generic handle io routine, this must be defined in the including file

+ 3 - 0
msg_translator.c

@@ -1606,6 +1606,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

@@ -323,6 +323,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){