Browse code

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

Andrei Pelinescu-Onciul authored on 20/07/2005 17:11:50
Showing 6 changed files
... ...
@@ -40,6 +40,7 @@
40 40
 #  2005-04-27  alpha support added (andrei)
41 41
 #  2005-06-01  use $(LOCALBASE) instead of /usr/{local,pkg} (andrei)
42 42
 #  2005-06-06  ppc64 support & missing ppc optimizations section added (andrei)
43
+#  2005-07-06  gcc 4.0 optimizations support (andrei)
43 44
 
44 45
 
45 46
 # check if already included/exported
... ...
@@ -55,8 +56,8 @@ MAIN_NAME=ser
55 56
 #version number
56 57
 VERSION = 0
57 58
 PATCHLEVEL = 9
58
-SUBLEVEL = 3
59
-EXTRAVERSION = 
59
+SUBLEVEL = 4
60
+EXTRAVERSION = -rc1
60 61
 
61 62
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
62 63
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
... ...
@@ -189,7 +190,8 @@ ifneq (,$(findstring gcc, $(CC_LONGVER)))
189 190
 				 sed -e 's/[^0-9]*-\(.*\)/\1/'| \
190 191
 				 sed -e 's/2\.9.*/2.9x/' -e 's/3\.[0-3]\..*/3.0/' -e \
191 192
 				 	's/3\.[0-3]/3.0/' -e 's/3\.[4-9]\..*/3.4/' -e \
192
-					's/3\.[4-9]/3.4/' )
193
+					's/3\.[4-9]/3.4/' -e 's/4\.[0-9]\..*/4.x/' -e \
194
+					's/4\.[0-9]/4.x/' )
193 195
 endif
194 196
 
195 197
 ifneq (, $(findstring Sun, $(CC_LONGVER)))
... ...
@@ -455,6 +457,14 @@ ifeq		($(CC_NAME), gcc)
455 457
 				#common stuff
456 458
 				CFLAGS=-g -O9 -funroll-loops  -Wcast-align $(PROFILE) \
457 459
 					-Wall  
460
+			#if gcc 4.0+
461
+ifeq			($(CC_SHORTVER), 4.x)
462
+					CPU ?= athlon64
463
+					CFLAGS+=-minline-all-stringops -malign-double \
464
+							-falign-loops \
465
+							-ftree-vectorize \
466
+							-mtune=$(CPU) 
467
+else
458 468
 			#if gcc 3.4+
459 469
 ifeq			($(CC_SHORTVER), 3.4)
460 470
 					CPU ?= athlon
... ...
@@ -483,6 +493,7 @@ $(warning			You are using an old and unsupported gcc \
483 493
 endif			# CC_SHORTVER, 2.9x
484 494
 endif			# CC_SHORTVER, 3.0
485 495
 endif			# CC_SHORTVER, 3.4
496
+endif			# CC_SHORTVER, 4.x
486 497
 
487 498
 else		# CC_NAME, gcc
488 499
 ifeq		($(CC_NAME), icc)
... ...
@@ -506,6 +517,14 @@ ifeq		($(CC_NAME), gcc)
506 517
 				#common stuff
507 518
 				CFLAGS=-g -O9 -funroll-loops  -Wcast-align $(PROFILE) \
508 519
 					-Wall 
520
+			#if gcc 4.0+
521
+ifeq			($(CC_SHORTVER), 4.x)
522
+					CPU ?= opteron
523
+					CFLAGS+=-minline-all-stringops \
524
+							-falign-loops \
525
+							-ftree-vectorize \
526
+							-mtune=$(CPU) 
527
+else
509 528
 			#if gcc 3.4
510 529
 ifeq			($(CC_SHORTVER), 3.4)
511 530
 					CPU ?= athlon64
... ...
@@ -534,6 +553,7 @@ $(warning			You are using an old and unsupported gcc \
534 553
 endif			# CC_SHORTVER, 2.9x
535 554
 endif			# CC_SHORTVER, 3.0
536 555
 endif			# CC_SHORTVER, 3.4
556
+endif			# CC_SHORTVER, 4.x
537 557
 
538 558
 else		# CC_NAME, gcc
539 559
 ifeq		($(CC_NAME), icc)
... ...
@@ -559,6 +579,14 @@ ifeq		($(CC_NAME), gcc)
559 579
 					-Wall\
560 580
 					#-Wcast-align \
561 581
 					#-Wmissing-prototypes 
582
+				#if gcc 4.x
583
+ifeq			($(CC_SHORTVER), 4.x)
584
+					CPU ?= ultrasparc
585
+					#use 32bit for now
586
+					CFLAGS+=-mcpu=ultrasparc -minline-all-stringops \
587
+							-mtune=$(CPU) \
588
+							-ftree-vectorize
589
+else
562 590
 				#if gcc 3.4
563 591
 ifeq			($(CC_SHORTVER), 3.4)
564 592
 					CPU ?= ultrasparc
... ...
@@ -602,6 +630,7 @@ endif
602 630
 endif			#CC_SHORTVER, 2.9x
603 631
 endif			#CC_SHORTVER, 3.0
604 632
 endif			#CC_SHORTVER, 3.4
633
+endif			#CC_SHORTVER, 4.x
605 634
 
606 635
 else		#CC_NAME, gcc
607 636
 ifeq		($(CC_NAME), suncc)
... ...
@@ -622,6 +651,11 @@ ifeq		($(CC_NAME), gcc)
622 651
 				#common stuff
623 652
 				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) \
624 653
 					-Wall   
654
+			#if gcc 4.x+
655
+ifeq			($(CC_SHORTVER), 4.x)
656
+					CFLAGS+=-mcpu=strongarm1100 -minline-all-stringops \
657
+							-ftree-vectorize
658
+else
625 659
 			#if gcc 3.4+
626 660
 ifeq			($(CC_SHORTVER), 3.4)
627 661
 					CFLAGS+= -mcpu=strongarm1100
... ...
@@ -644,6 +678,7 @@ $(warning			You are using an old and unsupported gcc \
644 678
 endif			# CC_SHORTVER, 2.9x
645 679
 endif			# CC_SHORTVER, 3.0
646 680
 endif			# CC_SHORTVER, 3.4
681
+endif			# CC_SHORTVER, 4.0
647 682
 	
648 683
 else		# CC_NAME, gcc
649 684
 				#other compilers
... ...
@@ -658,6 +693,11 @@ ifeq		($(CC_NAME), gcc)
658 693
 				#common stuff
659 694
 				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) \
660 695
 					-Wall 
696
+			#if gcc 4.0+
697
+ifeq			($(CC_SHORTVER), 4.x)
698
+					CFLAGS+=-mcpu=r3000 -minline-all-stringops \
699
+							-ftree-vectorize
700
+else
661 701
 			#if gcc 3.4+
662 702
 ifeq			($(CC_SHORTVER), 3.4)
663 703
 					CFLAGS+= -mcpu=r3000
... ...
@@ -680,6 +720,7 @@ $(warning			You are using an old and unsupported gcc \
680 720
 endif			# CC_SHORTVER, 2.9x
681 721
 endif			# CC_SHORTVER, 3.0
682 722
 endif			# CC_SHORTVER, 3.4
723
+endif			# CC_SHORTVER, 4.x
683 724
 	
684 725
 else		# CC_NAME, gcc
685 726
 				#other compilers
... ...
@@ -694,6 +735,10 @@ ifeq		($(CC_NAME), gcc)
694 735
 				#common stuff
695 736
 				CFLAGS= -mips2 -O9 -funroll-loops $(PROFILE) \
696 737
 					-Wall 
738
+			#if gcc 4.0+
739
+ifeq			($(CC_SHORTVER), 4.x)
740
+					CFLAGS+=-minline-all-stringops -ftree-vectorize
741
+else
697 742
 			#if gcc 3.4+
698 743
 ifeq			($(CC_SHORTVER), 3.4)
699 744
 					CFLAGS+=
... ...
@@ -714,6 +759,7 @@ $(warning			You are using an old and unsupported gcc \
714 759
 endif			# CC_SHORTVER, 2.9x
715 760
 endif			# CC_SHORTVER, 3.0
716 761
 endif			# CC_SHORTVER, 3.4
762
+endif			# CC_SHORTVER, 4.x
717 763
 	
718 764
 else		# CC_NAME, gcc
719 765
 				#other compilers
... ...
@@ -728,6 +774,10 @@ ifeq	($(ARCH), alpha)
728 774
 ifeq		($(CC_NAME), gcc)
729 775
 				#common stuff
730 776
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
777
+			#if gcc 4.0+
778
+ifeq			($(CC_SHORTVER), 4.x)
779
+					CFLAGS+=-minline-all-stringops
780
+else
731 781
 			#if gcc 3.4+
732 782
 ifeq			($(CC_SHORTVER), 3.4)
733 783
 					CFLAGS+=
... ...
@@ -748,6 +798,7 @@ $(warning			You are using an old and unsupported gcc \
748 798
 endif			# CC_SHORTVER, 2.9x
749 799
 endif			# CC_SHORTVER, 3.0
750 800
 endif			# CC_SHORTVER, 3.4
801
+endif			# CC_SHORTVER, 4.x
751 802
 	
752 803
 else		# CC_NAME, gcc
753 804
 				#other compilers
... ...
@@ -761,6 +812,12 @@ ifeq	($(ARCH), ppc)
761 812
 ifeq		($(CC_NAME), gcc)
762 813
 				#common stuff
763 814
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
815
+			#if gcc 4.0+
816
+ifeq			($(CC_SHORTVER), 4.x)
817
+					CPU ?= powerpc
818
+					CFLAGS+=-minline-all-stringops  -ftree-vectorize \
819
+							-mtune=$(CPU) -maltivec
820
+else
764 821
 			#if gcc 3.4+
765 822
 ifeq			($(CC_SHORTVER), 3.4)
766 823
 					CFLAGS+=
... ...
@@ -781,6 +838,7 @@ $(warning			You are using an old and unsupported gcc \
781 838
 endif			# CC_SHORTVER, 2.9x
782 839
 endif			# CC_SHORTVER, 3.0
783 840
 endif			# CC_SHORTVER, 3.4
841
+endif			# CC_SHORTVER, 4.x
784 842
 	
785 843
 else		# CC_NAME, gcc
786 844
 				#other compilers
... ...
@@ -794,6 +852,11 @@ ifeq	($(ARCH), ppc64)
794 852
 ifeq		($(CC_NAME), gcc)
795 853
 				#common stuff
796 854
 				CFLAGS= -O9 -funroll-loops $(PROFILE)  -Wall 
855
+ifeq			($(CC_SHORTVER), 4.x)
856
+					CPU ?= powerpc64
857
+					CFLAGS+=-minline-all-stringops  -ftree-vectorize \
858
+							-mtune=$(CPU) -maltivec
859
+else
797 860
 			#if gcc 3.4+
798 861
 ifeq			($(CC_SHORTVER), 3.4)
799 862
 					CFLAGS+=
... ...
@@ -814,6 +877,7 @@ $(warning			You are using an old and unsupported gcc \
814 877
 endif			# CC_SHORTVER, 2.9x
815 878
 endif			# CC_SHORTVER, 3.0
816 879
 endif			# CC_SHORTVER, 3.4
880
+endif			# CC_SHORTVER, 4.x
817 881
 	
818 882
 else		# CC_NAME, gcc
819 883
 				#other compilers
... ...
@@ -1605,6 +1605,9 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1605 1605
 	received_len=rport_len=warning_len=content_len_len=0;
1606 1606
 	
1607 1607
 	text_len=strlen(text);
1608
+
1609
+	to_tag.s=0;  /* fixes gcc 4.0 warning */
1610
+	to_tag.len=0;
1608 1611
 	
1609 1612
 	/* force parsing all headers -- we want to return all
1610 1613
 	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;
... ...
@@ -312,6 +312,8 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
312 312
 	b=v=0;
313 313
 	param=param_val=0;
314 314
 	pass=0;
315
+	password.s=0; /* fixes gcc 4.0 warning */
316
+	password.len=0;
315 317
 	port_no=0;
316 318
 	state=URI_INIT;
317 319
 	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){