Browse code

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

Andrei Pelinescu-Onciul authored on 06/07/2005 14:56:05
Showing 7 changed files
... ...
@@ -41,6 +41,7 @@
41 41
 #  2005-06-01  use $(LOCALBASE) instead of /usr/{local,pkg} (andrei)
42 42
 #  2005-06-26  numeric OSREL & HAVE_KQUEUE added to the *BSD (andrei)
43 43
 #  2005-07-04  HAVE_DEVPOLL added to solaris (andrei)
44
+#  2005-07-06  gcc 4.0 optimizations support (andrei)
44 45
 
45 46
 
46 47
 # check if already included/exported
... ...
@@ -197,7 +198,8 @@ ifneq (,$(findstring gcc, $(CC_LONGVER)))
197 197
 				 sed -e 's/[^0-9]*-\(.*\)/\1/'| \
198 198
 				 sed -e 's/2\.9.*/2.9x/' -e 's/3\.[0-3]\..*/3.0/' -e \
199 199
 				 	's/3\.[0-3]/3.0/' -e 's/3\.[4-9]\..*/3.4/' -e \
200
-					's/3\.[4-9]/3.4/' )
200
+					's/3\.[4-9]/3.4/' -e 's/4\.[0-9]\..*/4.x/' -e \
201
+					's/4\.[0-9]/4.x/' )
201 202
 endif
202 203
 
203 204
 ifneq (, $(findstring Sun, $(CC_LONGVER)))
... ...
@@ -463,6 +465,14 @@ ifeq		($(CC_NAME), gcc)
463 463
 				#common stuff
464 464
 				CFLAGS=-g -O9 -funroll-loops  -Wcast-align $(PROFILE) \
465 465
 					-Wall  
466
+			#if gcc 4.0+
467
+ifeq			($(CC_SHORTVER), 4.x)
468
+					CPU ?= athlon64
469
+					CFLAGS+=-minline-all-stringops -malign-double \
470
+							-falign-loops \
471
+							-ftree-vectorize \
472
+							-mtune=$(CPU) 
473
+else
466 474
 			#if gcc 3.4+
467 475
 ifeq			($(CC_SHORTVER), 3.4)
468 476
 					CPU ?= athlon
... ...
@@ -491,6 +501,7 @@ $(warning			You are using an old and unsupported gcc \
491 491
 endif			# CC_SHORTVER, 2.9x
492 492
 endif			# CC_SHORTVER, 3.0
493 493
 endif			# CC_SHORTVER, 3.4
494
+endif			# CC_SHORTVER, 4.x
494 495
 
495 496
 else		# CC_NAME, gcc
496 497
 ifeq		($(CC_NAME), icc)
... ...
@@ -514,6 +525,14 @@ ifeq		($(CC_NAME), gcc)
514 514
 				#common stuff
515 515
 				CFLAGS=-g -O9 -funroll-loops  -Wcast-align $(PROFILE) \
516 516
 					-Wall 
517
+			#if gcc 4.0+
518
+ifeq			($(CC_SHORTVER), 4.x)
519
+					CPU ?= opteron
520
+					CFLAGS+=-minline-all-stringops \
521
+							-falign-loops \
522
+							-ftree-vectorize \
523
+							-mtune=$(CPU) 
524
+else
517 525
 			#if gcc 3.4
518 526
 ifeq			($(CC_SHORTVER), 3.4)
519 527
 					CPU ?= athlon64
... ...
@@ -542,6 +561,7 @@ $(warning			You are using an old and unsupported gcc \
542 542
 endif			# CC_SHORTVER, 2.9x
543 543
 endif			# CC_SHORTVER, 3.0
544 544
 endif			# CC_SHORTVER, 3.4
545
+endif			# CC_SHORTVER, 4.x
545 546
 
546 547
 else		# CC_NAME, gcc
547 548
 ifeq		($(CC_NAME), icc)
... ...
@@ -567,6 +587,14 @@ ifeq		($(CC_NAME), gcc)
567 567
 					-Wall\
568 568
 					#-Wcast-align \
569 569
 					#-Wmissing-prototypes 
570
+				#if gcc 4.x
571
+ifeq			($(CC_SHORTVER), 4.x)
572
+					CPU ?= ultrasparc
573
+					#use 32bit for now
574
+					CFLAGS+=-mcpu=ultrasparc -minline-all-stringops \
575
+							-mtune=$(CPU) \
576
+							-ftree-vectorize
577
+else
570 578
 				#if gcc 3.4
571 579
 ifeq			($(CC_SHORTVER), 3.4)
572 580
 					CPU ?= ultrasparc
... ...
@@ -610,6 +638,7 @@ endif
610 610
 endif			#CC_SHORTVER, 2.9x
611 611
 endif			#CC_SHORTVER, 3.0
612 612
 endif			#CC_SHORTVER, 3.4
613
+endif			#CC_SHORTVER, 4.x
613 614
 
614 615
 else		#CC_NAME, gcc
615 616
 ifeq		($(CC_NAME), suncc)
... ...
@@ -630,6 +659,11 @@ ifeq		($(CC_NAME), gcc)
630 630
 				#common stuff
631 631
 				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) \
632 632
 					-Wall   
633
+			#if gcc 4.x+
634
+ifeq			($(CC_SHORTVER), 4.x)
635
+					CFLAGS+=-mcpu=strongarm1100 -minline-all-stringops \
636
+							-ftree-vectorize
637
+else
633 638
 			#if gcc 3.4+
634 639
 ifeq			($(CC_SHORTVER), 3.4)
635 640
 					CFLAGS+= -mcpu=strongarm1100
... ...
@@ -652,6 +686,7 @@ $(warning			You are using an old and unsupported gcc \
652 652
 endif			# CC_SHORTVER, 2.9x
653 653
 endif			# CC_SHORTVER, 3.0
654 654
 endif			# CC_SHORTVER, 3.4
655
+endif			# CC_SHORTVER, 4.0
655 656
 	
656 657
 else		# CC_NAME, gcc
657 658
 				#other compilers
... ...
@@ -666,6 +701,11 @@ ifeq		($(CC_NAME), gcc)
666 666
 				#common stuff
667 667
 				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) \
668 668
 					-Wall 
669
+			#if gcc 4.0+
670
+ifeq			($(CC_SHORTVER), 4.x)
671
+					CFLAGS+=-mcpu=r3000 -minline-all-stringops \
672
+							-ftree-vectorize
673
+else
669 674
 			#if gcc 3.4+
670 675
 ifeq			($(CC_SHORTVER), 3.4)
671 676
 					CFLAGS+= -mcpu=r3000
... ...
@@ -688,6 +728,7 @@ $(warning			You are using an old and unsupported gcc \
688 688
 endif			# CC_SHORTVER, 2.9x
689 689
 endif			# CC_SHORTVER, 3.0
690 690
 endif			# CC_SHORTVER, 3.4
691
+endif			# CC_SHORTVER, 4.x
691 692
 	
692 693
 else		# CC_NAME, gcc
693 694
 				#other compilers
... ...
@@ -702,6 +743,10 @@ ifeq		($(CC_NAME), gcc)
702 702
 				#common stuff
703 703
 				CFLAGS= -mips2 -O9 -funroll-loops $(PROFILE) \
704 704
 					-Wall 
705
+			#if gcc 4.0+
706
+ifeq			($(CC_SHORTVER), 4.x)
707
+					CFLAGS+=-minline-all-stringops -ftree-vectorize
708
+else
705 709
 			#if gcc 3.4+
706 710
 ifeq			($(CC_SHORTVER), 3.4)
707 711
 					CFLAGS+=
... ...
@@ -722,6 +767,7 @@ $(warning			You are using an old and unsupported gcc \
722 722
 endif			# CC_SHORTVER, 2.9x
723 723
 endif			# CC_SHORTVER, 3.0
724 724
 endif			# CC_SHORTVER, 3.4
725
+endif			# CC_SHORTVER, 4.x
725 726
 	
726 727
 else		# CC_NAME, gcc
727 728
 				#other compilers
... ...
@@ -736,6 +782,10 @@ ifeq	($(ARCH), alpha)
736 736
 ifeq		($(CC_NAME), gcc)
737 737
 				#common stuff
738 738
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
739
+			#if gcc 4.0+
740
+ifeq			($(CC_SHORTVER), 4.x)
741
+					CFLAGS+=-minline-all-stringops
742
+else
739 743
 			#if gcc 3.4+
740 744
 ifeq			($(CC_SHORTVER), 3.4)
741 745
 					CFLAGS+=
... ...
@@ -756,6 +806,7 @@ $(warning			You are using an old and unsupported gcc \
756 756
 endif			# CC_SHORTVER, 2.9x
757 757
 endif			# CC_SHORTVER, 3.0
758 758
 endif			# CC_SHORTVER, 3.4
759
+endif			# CC_SHORTVER, 4.x
759 760
 	
760 761
 else		# CC_NAME, gcc
761 762
 				#other compilers
... ...
@@ -769,6 +820,12 @@ ifeq	($(ARCH), ppc)
769 769
 ifeq		($(CC_NAME), gcc)
770 770
 				#common stuff
771 771
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
772
+			#if gcc 4.0+
773
+ifeq			($(CC_SHORTVER), 4.x)
774
+					CPU ?= powerpc
775
+					CFLAGS+=-minline-all-stringops  -ftree-vectorize \
776
+							-mtune=$(CPU) -maltivec
777
+else
772 778
 			#if gcc 3.4+
773 779
 ifeq			($(CC_SHORTVER), 3.4)
774 780
 					CFLAGS+=
... ...
@@ -789,6 +846,7 @@ $(warning			You are using an old and unsupported gcc \
789 789
 endif			# CC_SHORTVER, 2.9x
790 790
 endif			# CC_SHORTVER, 3.0
791 791
 endif			# CC_SHORTVER, 3.4
792
+endif			# CC_SHORTVER, 4.x
792 793
 	
793 794
 else		# CC_NAME, gcc
794 795
 				#other compilers
... ...
@@ -802,6 +860,11 @@ ifeq	($(ARCH), ppc64)
802 802
 ifeq		($(CC_NAME), gcc)
803 803
 				#common stuff
804 804
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
805
+ifeq			($(CC_SHORTVER), 4.x)
806
+					CPU ?= powerpc64
807
+					CFLAGS+=-minline-all-stringops  -ftree-vectorize \
808
+							-mtune=$(CPU) -maltivec
809
+else
805 810
 			#if gcc 3.4+
806 811
 ifeq			($(CC_SHORTVER), 3.4)
807 812
 					CFLAGS+=
... ...
@@ -822,6 +885,7 @@ $(warning			You are using an old and unsupported gcc \
822 822
 endif			# CC_SHORTVER, 2.9x
823 823
 endif			# CC_SHORTVER, 3.0
824 824
 endif			# CC_SHORTVER, 3.4
825
+endif			# CC_SHORTVER, 4.x
825 826
 	
826 827
 else		# CC_NAME, gcc
827 828
 				#other compilers
... ...
@@ -188,14 +188,6 @@ static inline struct fd_map* hash_fd_map(	io_wait_h* h,
188 188
 }
189 189
 
190 190
 
191
-#ifdef HAVE_SIGIO_RT
192
-typedef unsigned int sigio_rtsig_mask_t;
193
-extern sigset_t _sigio_rtsig_used;
194
-extern int _sigio_crt_rtsig;
195
-extern int _sigio_init;
196
-#endif
197
-
198
-
199 191
 
200 192
 #ifdef HANDLE_IO_INLINE
201 193
 /* generic handle io routine, this must be defined in the including file
... ...
@@ -1606,6 +1606,9 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1606 1606
 	received_len=rport_len=warning_len=content_len_len=0;
1607 1607
 	
1608 1608
 	text_len=strlen(text);
1609
+
1610
+	to_tag.s=0;  /* fixes gcc 4.0 warning */
1611
+	to_tag.len=0;
1609 1612
 	
1610 1613
 	/* force parsing all headers -- we want to return all
1611 1614
 	Via's in the reply and they may be scattered down to the
... ...
@@ -227,6 +227,8 @@ static int parse_method(str* _next, unsigned int* _method)
227 227
  {
228 228
  	str next;
229 229
  	unsigned int method;
230
+	
231
+	method=0; /* fixes silly gcc 4.x warning */
230 232
  
231 233
 	if (!_body || !_methods) {
232 234
 		LOG(L_ERR, "parse_methods: Invalid parameter value\n");
... ...
@@ -496,7 +496,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
496 496
 	int status;
497 497
 	int saved_status;
498 498
 	char  *tmp,*foo;
499
-
499
+	
500
+	saved_status=START_TO; /* fixes gcc 4.x warning */
500 501
 	status=START_TO;
501 502
 	to_b->error=PARSE_OK;
502 503
 	to_b->uri.len = 0;
... ...
@@ -323,6 +323,8 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
323 323
 	b=v=0;
324 324
 	param=param_val=0;
325 325
 	pass=0;
326
+	password.s=0; /* fixes gcc 4.0 warning */
327
+	password.len=0;
326 328
 	port_no=0;
327 329
 	state=URI_INIT;
328 330
 	memset(uri, 0, sizeof(struct sip_uri)); /* zero it all, just to be sure*/
... ...
@@ -1011,6 +1011,7 @@ parse_again:
1011 1011
 	vb->error=PARSE_ERROR;
1012 1012
 	/* parse start of via ( SIP/2.0/UDP    )*/
1013 1013
 	state=F_SIP;
1014
+	saved_state=F_SIP; /* fixes gcc 4.0 warning */
1014 1015
 	param_start=0;
1015 1016
 	for(tmp=buffer;tmp<end;tmp++){
1016 1017
 		switch(*tmp){