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 198
 				 sed -e 's/[^0-9]*-\(.*\)/\1/'| \
198 199
 				 sed -e 's/2\.9.*/2.9x/' -e 's/3\.[0-3]\..*/3.0/' -e \
199 200
 				 	's/3\.[0-3]/3.0/' -e 's/3\.[4-9]\..*/3.4/' -e \
200
-					's/3\.[4-9]/3.4/' )
201
+					's/3\.[4-9]/3.4/' -e 's/4\.[0-9]\..*/4.x/' -e \
202
+					's/4\.[0-9]/4.x/' )
201 203
 endif
202 204
 
203 205
 ifneq (, $(findstring Sun, $(CC_LONGVER)))
... ...
@@ -463,6 +465,14 @@ ifeq		($(CC_NAME), gcc)
463 465
 				#common stuff
464 466
 				CFLAGS=-g -O9 -funroll-loops  -Wcast-align $(PROFILE) \
465 467
 					-Wall  
468
+			#if gcc 4.0+
469
+ifeq			($(CC_SHORTVER), 4.x)
470
+					CPU ?= athlon64
471
+					CFLAGS+=-minline-all-stringops -malign-double \
472
+							-falign-loops \
473
+							-ftree-vectorize \
474
+							-mtune=$(CPU) 
475
+else
466 476
 			#if gcc 3.4+
467 477
 ifeq			($(CC_SHORTVER), 3.4)
468 478
 					CPU ?= athlon
... ...
@@ -491,6 +501,7 @@ $(warning			You are using an old and unsupported gcc \
491 501
 endif			# CC_SHORTVER, 2.9x
492 502
 endif			# CC_SHORTVER, 3.0
493 503
 endif			# CC_SHORTVER, 3.4
504
+endif			# CC_SHORTVER, 4.x
494 505
 
495 506
 else		# CC_NAME, gcc
496 507
 ifeq		($(CC_NAME), icc)
... ...
@@ -514,6 +525,14 @@ ifeq		($(CC_NAME), gcc)
514 525
 				#common stuff
515 526
 				CFLAGS=-g -O9 -funroll-loops  -Wcast-align $(PROFILE) \
516 527
 					-Wall 
528
+			#if gcc 4.0+
529
+ifeq			($(CC_SHORTVER), 4.x)
530
+					CPU ?= opteron
531
+					CFLAGS+=-minline-all-stringops \
532
+							-falign-loops \
533
+							-ftree-vectorize \
534
+							-mtune=$(CPU) 
535
+else
517 536
 			#if gcc 3.4
518 537
 ifeq			($(CC_SHORTVER), 3.4)
519 538
 					CPU ?= athlon64
... ...
@@ -542,6 +561,7 @@ $(warning			You are using an old and unsupported gcc \
542 561
 endif			# CC_SHORTVER, 2.9x
543 562
 endif			# CC_SHORTVER, 3.0
544 563
 endif			# CC_SHORTVER, 3.4
564
+endif			# CC_SHORTVER, 4.x
545 565
 
546 566
 else		# CC_NAME, gcc
547 567
 ifeq		($(CC_NAME), icc)
... ...
@@ -567,6 +587,14 @@ ifeq		($(CC_NAME), gcc)
567 587
 					-Wall\
568 588
 					#-Wcast-align \
569 589
 					#-Wmissing-prototypes 
590
+				#if gcc 4.x
591
+ifeq			($(CC_SHORTVER), 4.x)
592
+					CPU ?= ultrasparc
593
+					#use 32bit for now
594
+					CFLAGS+=-mcpu=ultrasparc -minline-all-stringops \
595
+							-mtune=$(CPU) \
596
+							-ftree-vectorize
597
+else
570 598
 				#if gcc 3.4
571 599
 ifeq			($(CC_SHORTVER), 3.4)
572 600
 					CPU ?= ultrasparc
... ...
@@ -610,6 +638,7 @@ endif
610 638
 endif			#CC_SHORTVER, 2.9x
611 639
 endif			#CC_SHORTVER, 3.0
612 640
 endif			#CC_SHORTVER, 3.4
641
+endif			#CC_SHORTVER, 4.x
613 642
 
614 643
 else		#CC_NAME, gcc
615 644
 ifeq		($(CC_NAME), suncc)
... ...
@@ -630,6 +659,11 @@ ifeq		($(CC_NAME), gcc)
630 659
 				#common stuff
631 660
 				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) \
632 661
 					-Wall   
662
+			#if gcc 4.x+
663
+ifeq			($(CC_SHORTVER), 4.x)
664
+					CFLAGS+=-mcpu=strongarm1100 -minline-all-stringops \
665
+							-ftree-vectorize
666
+else
633 667
 			#if gcc 3.4+
634 668
 ifeq			($(CC_SHORTVER), 3.4)
635 669
 					CFLAGS+= -mcpu=strongarm1100
... ...
@@ -652,6 +686,7 @@ $(warning			You are using an old and unsupported gcc \
652 686
 endif			# CC_SHORTVER, 2.9x
653 687
 endif			# CC_SHORTVER, 3.0
654 688
 endif			# CC_SHORTVER, 3.4
689
+endif			# CC_SHORTVER, 4.0
655 690
 	
656 691
 else		# CC_NAME, gcc
657 692
 				#other compilers
... ...
@@ -666,6 +701,11 @@ ifeq		($(CC_NAME), gcc)
666 701
 				#common stuff
667 702
 				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) \
668 703
 					-Wall 
704
+			#if gcc 4.0+
705
+ifeq			($(CC_SHORTVER), 4.x)
706
+					CFLAGS+=-mcpu=r3000 -minline-all-stringops \
707
+							-ftree-vectorize
708
+else
669 709
 			#if gcc 3.4+
670 710
 ifeq			($(CC_SHORTVER), 3.4)
671 711
 					CFLAGS+= -mcpu=r3000
... ...
@@ -688,6 +728,7 @@ $(warning			You are using an old and unsupported gcc \
688 728
 endif			# CC_SHORTVER, 2.9x
689 729
 endif			# CC_SHORTVER, 3.0
690 730
 endif			# CC_SHORTVER, 3.4
731
+endif			# CC_SHORTVER, 4.x
691 732
 	
692 733
 else		# CC_NAME, gcc
693 734
 				#other compilers
... ...
@@ -702,6 +743,10 @@ ifeq		($(CC_NAME), gcc)
702 743
 				#common stuff
703 744
 				CFLAGS= -mips2 -O9 -funroll-loops $(PROFILE) \
704 745
 					-Wall 
746
+			#if gcc 4.0+
747
+ifeq			($(CC_SHORTVER), 4.x)
748
+					CFLAGS+=-minline-all-stringops -ftree-vectorize
749
+else
705 750
 			#if gcc 3.4+
706 751
 ifeq			($(CC_SHORTVER), 3.4)
707 752
 					CFLAGS+=
... ...
@@ -722,6 +767,7 @@ $(warning			You are using an old and unsupported gcc \
722 767
 endif			# CC_SHORTVER, 2.9x
723 768
 endif			# CC_SHORTVER, 3.0
724 769
 endif			# CC_SHORTVER, 3.4
770
+endif			# CC_SHORTVER, 4.x
725 771
 	
726 772
 else		# CC_NAME, gcc
727 773
 				#other compilers
... ...
@@ -736,6 +782,10 @@ ifeq	($(ARCH), alpha)
736 782
 ifeq		($(CC_NAME), gcc)
737 783
 				#common stuff
738 784
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
785
+			#if gcc 4.0+
786
+ifeq			($(CC_SHORTVER), 4.x)
787
+					CFLAGS+=-minline-all-stringops
788
+else
739 789
 			#if gcc 3.4+
740 790
 ifeq			($(CC_SHORTVER), 3.4)
741 791
 					CFLAGS+=
... ...
@@ -756,6 +806,7 @@ $(warning			You are using an old and unsupported gcc \
756 806
 endif			# CC_SHORTVER, 2.9x
757 807
 endif			# CC_SHORTVER, 3.0
758 808
 endif			# CC_SHORTVER, 3.4
809
+endif			# CC_SHORTVER, 4.x
759 810
 	
760 811
 else		# CC_NAME, gcc
761 812
 				#other compilers
... ...
@@ -769,6 +820,12 @@ ifeq	($(ARCH), ppc)
769 820
 ifeq		($(CC_NAME), gcc)
770 821
 				#common stuff
771 822
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
823
+			#if gcc 4.0+
824
+ifeq			($(CC_SHORTVER), 4.x)
825
+					CPU ?= powerpc
826
+					CFLAGS+=-minline-all-stringops  -ftree-vectorize \
827
+							-mtune=$(CPU) -maltivec
828
+else
772 829
 			#if gcc 3.4+
773 830
 ifeq			($(CC_SHORTVER), 3.4)
774 831
 					CFLAGS+=
... ...
@@ -789,6 +846,7 @@ $(warning			You are using an old and unsupported gcc \
789 846
 endif			# CC_SHORTVER, 2.9x
790 847
 endif			# CC_SHORTVER, 3.0
791 848
 endif			# CC_SHORTVER, 3.4
849
+endif			# CC_SHORTVER, 4.x
792 850
 	
793 851
 else		# CC_NAME, gcc
794 852
 				#other compilers
... ...
@@ -802,6 +860,11 @@ ifeq	($(ARCH), ppc64)
802 860
 ifeq		($(CC_NAME), gcc)
803 861
 				#common stuff
804 862
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
863
+ifeq			($(CC_SHORTVER), 4.x)
864
+					CPU ?= powerpc64
865
+					CFLAGS+=-minline-all-stringops  -ftree-vectorize \
866
+							-mtune=$(CPU) -maltivec
867
+else
805 868
 			#if gcc 3.4+
806 869
 ifeq			($(CC_SHORTVER), 3.4)
807 870
 					CFLAGS+=
... ...
@@ -822,6 +885,7 @@ $(warning			You are using an old and unsupported gcc \
822 885
 endif			# CC_SHORTVER, 2.9x
823 886
 endif			# CC_SHORTVER, 3.0
824 887
 endif			# CC_SHORTVER, 3.4
888
+endif			# CC_SHORTVER, 4.x
825 889
 	
826 890
 else		# CC_NAME, gcc
827 891
 				#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){