]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Improved compatibility with clang and icc
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 11 Sep 2013 00:58:09 +0000 (18:58 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 11 Sep 2013 00:58:09 +0000 (18:58 -0600)
18 files changed:
acinclude/compiler-flags.m4
compat/GnuRegex.c
lib/rfcnb/session.c
lib/smblib/smblib.c
src/ssl/gadgets.cc
tools/purge/conffile.cc
tools/purge/conffile.hh
tools/purge/convert.cc
tools/purge/convert.hh
tools/purge/copyout.cc
tools/purge/copyout.hh
tools/purge/purge.cc
tools/purge/signal.cc
tools/purge/signal.hh
tools/purge/socket.cc
tools/purge/socket.hh
tools/purge/squid-tlv.cc
tools/purge/squid-tlv.hh

index 345c2dea05bf6fd24f867a78b839087e35129cea..6ece7d7945601ae892f7cff70caa6f7c3e86ab15 100644 (file)
@@ -170,8 +170,8 @@ AC_DEFUN([SQUID_CC_GUESS_OPTIONS], [
    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=""
index 3285f687eabec500a05aefaddd7a72cfb59fd20e..0dac6063a77d562225c8a56e298dd2e24695432e 100644 (file)
@@ -90,8 +90,6 @@ init_syntax_once(void)
 
 #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 @@ static reg_errcode_t compile_range(const char **p_ptr, const char *pend, char *t
 
 #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 @@ handle_open:
                 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 @@ handle_open:
                 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 @@ handle_close:
                     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 @@ normal_char:
     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 @@ struct re_pattern_buffer *bufp;
 
         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 @@ static boolean group_match_null_string_p(unsigned char **p, unsigned char *end,
 /* 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 @@ restore_best_regs:
         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 @@ restore_best_regs:
             /* 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 @@ unconditional_jump:
 
         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 @@ unconditional_jump:
         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++;
index 4aaf11b764bca8c9a7266c2d28fd72d4d6a99479..b2d4246ea55acc61c5c7b0fb9686f5334cfadaef 100644 (file)
@@ -84,7 +84,7 @@ RFCNB_Call(char *Called_Name, char *Calling_Name, char *Called_Address, int port
     /* 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 */
index 79de3d61436f01bad8aed9c4dc403571fa5b5c9b..7eade4fc6c6493343a0546199769f41eafdb40f1 100644 (file)
@@ -152,7 +152,7 @@ SMB_Handle_Type SMB_Connect_Server(SMB_Handle_Type Con_Handle,
 
     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 @@ SMB_Handle_Type SMB_Connect(SMB_Handle_Type Con_Handle,
 
     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;
index 9a891871001e43cce20f12e0c587d74ca845db3a..c6f8d253a53107ccdf174b35a19a68125c86c15e 100644 (file)
@@ -410,7 +410,7 @@ static  BIGNUM *createCertSerial(unsigned char *md, unsigned int n)
     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
index 8a17e7a9e758627c21356a72ec272af8ab92d6f9..8d3fb62bd14024d609cd8353990b2769d1f489d3 100644 (file)
 // Initial revision
 //
 //
-#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__)
-#pragma implementation
-#endif
-
 #include "conffile.hh"
 #include <sys/types.h>
 #include <errno.h>
index 960fd8ec635d5f5d778b239ea0589258cbf03469..a37ae88d4f306c5f4b4eab181e1a864de27abea2 100644 (file)
 #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 */
 
 
index 64e8ec1415ca3946e86fdead06447bcf30d1cb5c..2d0df6fc5fb4b0752e2d0a6191fdbfadf4238472 100644 (file)
@@ -40,9 +40,6 @@
 // Initial revision
 //
 //
-#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__)
-#pragma implementation
-#endif
 
 #include "convert.hh"
 #include <string.h>
index c84272402024040e8975d23d0d1ea9e17655e24c..5cd39b7454681021a749b856f90780231a11f92d 100644 (file)
 #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 <sys/types.h>
index 872c8165804e987589b74f951277c35dd4affb9b..f57554ef24b017732d8f3c81136af387fc07721e 100644 (file)
 // Initial revision
 //
 //
-#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__)
-#pragma implementation
-#endif
-
 #include "squid.h"
 #include "copyout.hh"
 
index f39907e0c4cba4b0d4b2c96b23eea9ec207943a7..5440490900cc3893babc39e4f068b8f7abb89a32 100644 (file)
 #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
index 4e65720e56c06cbfeca53de0377ea271a4b82a57..6f91f8e200655b8a3c03ddee729beb8fb81499dc 100644 (file)
 // Initial revision
 //
 //
-#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__)
-#pragma implementation
-#endif
-
 #include "squid.h"
 #include "util.h"
 
index 213353f44e31ab9937d6bb60a4e80c03d753054f..4f6906c2eb218ec20138c1ef30ec35906c01d05b 100644 (file)
 // Initial revision
 //
 //
-
-#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__)
-#pragma implementation
-#endif
-
 #include "squid.h"
 #include "signal.hh"
 
index 19d9e5749be3ba649be556f038949952fb20dc85..1e021cbfe70d3bfa49ca54cd84ef2e4c54c73932 100644 (file)
 #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
index d8884f10b8b704211632bb494f6ed10f1fbb90f0..27d8b3b4813e4faddbd65a0558a1ce79b44635bf 100644 (file)
 // Initial revision
 //
 //
-#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__)
-#pragma implementation
-#endif
-
 #include "socket.hh"
 #include <netinet/tcp.h>
 #include <arpa/inet.h>
index 22679c711f79ca70a305fda965140dcb7dbe4523..c1631bc74f0aeb41802adbee6da7673de5dd5935 100644 (file)
 #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 <sys/types.h>
index e3fc2105d28db508a63d7401a5a0db651d189f78..7225f11a53eee4ba8a11eeb7a64eb7a0c915d71b 100644 (file)
 // Initial revision
 //
 //
-#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__)
-#pragma implementation
-#endif
-
 #include "squid.h"
 //#include <assert.h>
 #include "squid-tlv.hh"
index 5be4056af56ee39f61b701fca221dec39fecb10a..fdaec97ffdd31e43cda5527f3624afeeeb4a6f18 100644 (file)
 #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 <sys/types.h>