------------------------------------------------------------ revno: 12617 revision-id: squid3@treenet.co.nz-20130911005809-hnd3tqx7bl677jti parent: squid3@treenet.co.nz-20130910113349-07vrcfj5xj9ikgw5 author: Francesco Chemolli committer: Amos Jeffries branch nick: 3.3 timestamp: Tue 2013-09-10 18:58:09 -0600 message: Improved compatibility with clang and icc ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20130911005809-hnd3tqx7bl677jti # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: 5197647cc6bbb46be463f80c47d8cc12b0f928e2 # timestamp: 2013-09-11 01:08:38 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20130910113349-\ # 07vrcfj5xj9ikgw5 # # Begin patch === modified file 'acinclude/compiler-flags.m4' --- acinclude/compiler-flags.m4 2013-04-18 05:28:16 +0000 +++ acinclude/compiler-flags.m4 2013-09-11 00:58:09 +0000 @@ -170,8 +170,8 @@ squid_cv_cc_arg_pipe="" ;; clang) - squid_cv_cxx_option_werror="-Werror -Wno-error=parentheses-equality" - squid_cv_cc_option_werror="$squid_cv_cxx_option_werror" + squid_cv_cxx_option_werror="-Werror -Qunused-arguments" + squid_cv_cc_option_werror="$squid_cv_cxx_option_werror" squid_cv_cc_option_wall="-Wall" squid_cv_cc_option_optimize="-O2" squid_cv_cc_arg_pipe="" === modified file 'compat/GnuRegex.c' --- compat/GnuRegex.c 2012-10-04 11:10:17 +0000 +++ compat/GnuRegex.c 2013-09-11 00:58:09 +0000 @@ -90,8 +90,6 @@ #endif /* not SYNTAX_TABLE */ -#define SYNTAX(c) re_syntax_table[c] - /* Get the interface, including the syntax bits. */ #include "compat/GnuRegex.h" @@ -889,9 +887,6 @@ #define INIT_COMPILE_STACK_SIZE 32 -#define COMPILE_STACK_EMPTY (compile_stack.avail == 0) -#define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size) - /* The next available element. */ #define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail]) @@ -1420,7 +1415,7 @@ bufp->re_nsub++; regnum++; - if (COMPILE_STACK_FULL) { + if (compile_stack.avail == compile_stack.size) { RETALLOC(compile_stack.stack, compile_stack.size << 1, compile_stack_elt_t); if (compile_stack.stack == NULL) @@ -1461,7 +1456,7 @@ if (syntax & RE_NO_BK_PARENS) goto normal_backslash; - if (COMPILE_STACK_EMPTY) { + if (compile_stack.avail == 0) { if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) goto normal_backslash; else @@ -1479,7 +1474,7 @@ STORE_JUMP(jump_past_alt, fixup_alt_jump, b - 1); } /* See similar code for backslashed left paren above. */ - if (COMPILE_STACK_EMPTY) { + if (compile_stack.avail == 0) { if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) goto normal_char; else @@ -1832,7 +1827,7 @@ if (fixup_alt_jump) STORE_JUMP(jump_past_alt, fixup_alt_jump, b); - if (!COMPILE_STACK_EMPTY) + if (compile_stack.avail != 0) return REG_EPAREN; free(compile_stack.stack); @@ -2374,13 +2369,13 @@ case wordchar: for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX(j) == Sword) + if (re_syntax_table[j] == Sword) fastmap[j] = 1; break; case notwordchar: for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX(j) != Sword) + if (re_syntax_table[j] != Sword) fastmap[j] = 1; break; @@ -2732,21 +2727,31 @@ /* Test if at very beginning or at very end of the virtual concatenation * of `string1' and `string2'. If only one string, it's `string2'. */ #define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) -#define AT_STRINGS_END(d) ((d) == end2) +static int at_strings_end(const char *d, const char *end2) +{ + return d == end2; +} /* Test if D points to a character which is word-constituent. We have * two special cases to check for: if past the end of string1, look at * the first character in string2; and if before the beginning of * string2, look at the last character in string1. */ #define WORDCHAR_P(d) \ - (SYNTAX ((d) == end1 ? *string2 \ - : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ + (re_syntax_table[(d) == end1 ? *string2 \ + : (d) == string2 - 1 ? *(end1 - 1) : *(d)] \ == Sword) +static int +wordchar_p(const char *d, const char *end1, const char *string2) +{ + return re_syntax_table[(d) == end1 ? *string2 + : (d) == string2 - 1 ? *(end1 - 1) : *(d)] + == Sword; +} /* Test if the character before D and the one at D differ with respect * to being word-constituent. */ #define AT_WORD_BOUNDARY(d) \ - (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \ + (AT_STRINGS_BEG (d) || at_strings_end(d,end2) \ || WORDCHAR_P (d - 1) != WORDCHAR_P (d)) /* Free everything we malloc. */ @@ -3440,7 +3445,7 @@ case endline: DEBUG_PRINT1("EXECUTING endline.\n"); - if (AT_STRINGS_END(d)) { + if (at_strings_end(d,end2)) { if (!bufp->not_eol) break; } @@ -3461,7 +3466,7 @@ /* Match at the very end of the data. */ case endbuf: DEBUG_PRINT1("EXECUTING endbuf.\n"); - if (AT_STRINGS_END(d)) + if (at_strings_end(d,end2)) break; goto fail; @@ -3739,21 +3744,21 @@ case wordbeg: DEBUG_PRINT1("EXECUTING wordbeg.\n"); - if (WORDCHAR_P(d) && (AT_STRINGS_BEG(d) || !WORDCHAR_P(d - 1))) + if (wordchar_p(d,end1,string2) && (AT_STRINGS_BEG(d) || !WORDCHAR_P(d - 1))) break; goto fail; case wordend: DEBUG_PRINT1("EXECUTING wordend.\n"); if (!AT_STRINGS_BEG(d) && WORDCHAR_P(d - 1) - && (!WORDCHAR_P(d) || AT_STRINGS_END(d))) + && (!wordchar_p(d,end1,string2) || at_strings_end(d,end2))) break; goto fail; case wordchar: DEBUG_PRINT1("EXECUTING non-Emacs wordchar.\n"); PREFETCH(); - if (!WORDCHAR_P(d)) + if (!wordchar_p(d,end1,string2)) goto fail; SET_REGS_MATCHED(); d++; @@ -3762,7 +3767,7 @@ case notwordchar: DEBUG_PRINT1("EXECUTING non-Emacs notwordchar.\n"); PREFETCH(); - if (WORDCHAR_P(d)) + if (wordchar_p(d,end1,string2)) goto fail; SET_REGS_MATCHED(); d++; === modified file 'lib/rfcnb/session.c' --- lib/rfcnb/session.c 2013-02-08 10:13:05 +0000 +++ lib/rfcnb/session.c 2013-09-11 00:58:09 +0000 @@ -84,7 +84,7 @@ /* Resolve that name into an IP address */ Service_Address = Called_Name; - if (strcmp(Called_Address, "") != 0) { /* If the Called Address = "" */ + if (strlen(Called_Address) != 0) { /* If the Called Address = "" */ Service_Address = Called_Address; } if ((errno = RFCNB_Name_To_IP(Service_Address, &Dest_IP)) < 0) { /* Error */ === modified file 'lib/smblib/smblib.c' --- lib/smblib/smblib.c 2013-01-02 10:04:32 +0000 +++ lib/smblib/smblib.c 2013-09-11 00:58:09 +0000 @@ -152,7 +152,7 @@ calling[strlen(con -> myname)] = 0; /* Make it a string */ - if (strcmp(con -> address, "") == 0) + if (strlen(con -> address) == 0) address = con -> desthost; else address = con -> address; @@ -268,7 +268,7 @@ calling[strlen(con -> myname)] = 0; /* Make it a string */ - if (strcmp(con -> address, "") == 0) + if (strlen(con -> address) == 0) address = con -> desthost; else address = con -> address; === modified file 'src/ssl/gadgets.cc' --- src/ssl/gadgets.cc 2013-02-01 04:47:04 +0000 +++ src/ssl/gadgets.cc 2013-09-11 00:58:09 +0000 @@ -410,7 +410,7 @@ serial = BN_bin2bn(md, n, NULL); // if the serial is "0" set it to '1' - if (BN_is_zero(serial)) + if (BN_is_zero(serial) == true) BN_one(serial); // serial size does not exceed 20 bytes === modified file 'tools/purge/conffile.cc' --- tools/purge/conffile.cc 2012-10-28 05:31:57 +0000 +++ tools/purge/conffile.cc 2013-09-11 00:58:09 +0000 @@ -34,10 +34,6 @@ // Initial revision // // -#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) -#pragma implementation -#endif - #include "conffile.hh" #include #include === modified file 'tools/purge/conffile.hh' --- tools/purge/conffile.hh 2012-10-04 11:10:17 +0000 +++ tools/purge/conffile.hh 2013-09-11 00:58:09 +0000 @@ -39,16 +39,12 @@ #define _CONFFILE_HH #if !defined(__cplusplus) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma interface -#else #ifndef HAVE_BOOL #define HAVE_BOOL typedef int bool; #define false 0 #define true 1 #endif -#endif #endif /* __cplusplus */ === modified file 'tools/purge/convert.cc' --- tools/purge/convert.cc 2012-10-04 11:10:17 +0000 +++ tools/purge/convert.cc 2013-09-11 00:58:09 +0000 @@ -40,9 +40,6 @@ // Initial revision // // -#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) -#pragma implementation -#endif #include "convert.hh" #include === modified file 'tools/purge/convert.hh' --- tools/purge/convert.hh 2012-10-04 11:10:17 +0000 +++ tools/purge/convert.hh 2013-09-11 00:58:09 +0000 @@ -39,16 +39,12 @@ #define _CONVERT_HH #if !defined(__cplusplus) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma interface -#else #ifndef HAVE_BOOL #define HAVE_BOOL 1 typedef char bool; #define false 0 #define true 1 #endif -#endif #endif /* __cplusplus */ #include === modified file 'tools/purge/copyout.cc' --- tools/purge/copyout.cc 2012-10-04 11:10:17 +0000 +++ tools/purge/copyout.cc 2013-09-11 00:58:09 +0000 @@ -35,10 +35,6 @@ // Initial revision // // -#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) -#pragma implementation -#endif - #include "squid.h" #include "copyout.hh" === modified file 'tools/purge/copyout.hh' --- tools/purge/copyout.hh 2012-10-04 11:10:17 +0000 +++ tools/purge/copyout.hh 2013-09-11 00:58:09 +0000 @@ -35,16 +35,12 @@ #define _COPYOUT_HH #if !defined(__cplusplus) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma interface -#else #ifndef HAVE_BOOL #define HAVE_BOOL typedef int bool; #define false 0 #define true 1 #endif -#endif #endif /* __cplusplus */ int === modified file 'tools/purge/purge.cc' --- tools/purge/purge.cc 2013-01-28 04:07:58 +0000 +++ tools/purge/purge.cc 2013-09-11 00:58:09 +0000 @@ -90,10 +90,6 @@ // Initial revision // // -#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) -#pragma implementation -#endif - #include "squid.h" #include "util.h" === modified file 'tools/purge/signal.cc' --- tools/purge/signal.cc 2012-10-04 11:10:17 +0000 +++ tools/purge/signal.cc 2013-09-11 00:58:09 +0000 @@ -41,11 +41,6 @@ // Initial revision // // - -#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) -#pragma implementation -#endif - #include "squid.h" #include "signal.hh" === modified file 'tools/purge/signal.hh' --- tools/purge/signal.hh 2012-10-04 11:10:17 +0000 +++ tools/purge/signal.hh 2013-09-11 00:58:09 +0000 @@ -55,16 +55,12 @@ #endif #if !defined(__cplusplus) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma interface -#else #ifndef HAVE_BOOL #define HAVE_BOOL typedef int bool; #define false 0 #define true 1 #endif -#endif #endif /* __cplusplus */ #if 1 // so far, all systems I know use void === modified file 'tools/purge/socket.cc' --- tools/purge/socket.cc 2012-10-04 11:10:17 +0000 +++ tools/purge/socket.cc 2013-09-11 00:58:09 +0000 @@ -42,10 +42,6 @@ // Initial revision // // -#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) -#pragma implementation -#endif - #include "socket.hh" #include #include === modified file 'tools/purge/socket.hh' --- tools/purge/socket.hh 2012-10-04 11:10:17 +0000 +++ tools/purge/socket.hh 2013-09-11 00:58:09 +0000 @@ -45,16 +45,12 @@ #define _SOCKET_HH #if !defined(__cplusplus) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma interface -#else #ifndef HAVE_BOOL #define HAVE_BOOL typedef int bool; #define false 0 #define true 1 #endif -#endif #endif /* __cplusplus */ #include === modified file 'tools/purge/squid-tlv.cc' --- tools/purge/squid-tlv.cc 2012-10-04 11:10:17 +0000 +++ tools/purge/squid-tlv.cc 2013-09-11 00:58:09 +0000 @@ -32,10 +32,6 @@ // Initial revision // // -#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) -#pragma implementation -#endif - #include "squid.h" //#include #include "squid-tlv.hh" === modified file 'tools/purge/squid-tlv.hh' --- tools/purge/squid-tlv.hh 2012-10-04 11:10:17 +0000 +++ tools/purge/squid-tlv.hh 2013-09-11 00:58:09 +0000 @@ -35,16 +35,12 @@ #define SQUID_TLV_HH #if !defined(__cplusplus) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma interface -#else #ifndef HAVE_BOOL #define HAVE_BOOL typedef int bool; #define false 0 #define true 1 #endif -#endif #endif /* __cplusplus */ #include