bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 07/18] gperf*.c: Fix compiler warnings


From: Tim Hentenaar
Subject: [PATCH 07/18] gperf*.c: Fix compiler warnings
Date: Sat, 4 Jul 2015 13:43:21 +0200

Signed-off-by: Tim Hentenaar <address@hidden>
---
 src/gperf-cc.c | 34 +++++++++++++++-------------------
 src/gperf.c    | 34 +++++++++++++++-------------------
 src/lexi.c     |  4 ++++
 3 files changed, 34 insertions(+), 38 deletions(-)

diff --git a/src/gperf-cc.c b/src/gperf-cc.c
index 95be172..60a4d2b 100644
--- a/src/gperf-cc.c
+++ b/src/gperf-cc.c
@@ -1,5 +1,5 @@
-/* C code produced by gperf version 3.0.3 */
-/* Command-line: gperf -D -c -l -p -t -T -g -j1 -o -K rwd -N is_reserved_cc -H 
hash_cc indent-cc.gperf  */
+/* ANSI-C code produced by gperf version 3.0.4 */
+/* Command-line: gperf -D -c -l -p -t -T -g -j1 -o -K rwd -L ANSI-C -N 
is_reserved_cc -H hash_cc indent-cc.gperf  */
 /* Computed positions: -k'1,3' */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -26,7 +26,7 @@
       && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
       && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
 /* The character set is not based on ISO-646.  */
-error "gperf generated tables don't work with this execution character set. 
Please report a bug to <address@hidden>."
+#error "gperf generated tables don't work with this execution character set. 
Please report a bug to <address@hidden>."
 #endif
 
 
@@ -45,9 +45,7 @@ inline
 #endif
 #endif
 static unsigned int
-hash_cc (str, len)
-     register const char *str;
-     register unsigned int len;
+hash_cc (register const char *str, register unsigned int len)
 {
   static unsigned char asso_values[] =
     {
@@ -78,7 +76,7 @@ hash_cc (str, len)
       58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
       58, 58, 58, 58, 58, 58
     };
-  register int hval = len;
+  register unsigned int hval = len;
 
   switch (hval)
     {
@@ -95,14 +93,12 @@ hash_cc (str, len)
 
 #ifdef __GNUC__
 __inline
-#ifdef __GNUC_STDC_INLINE__
+#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
 __attribute__ ((__gnu_inline__))
 #endif
 #endif
 templ_ty *
-is_reserved_cc (str, len)
-     register const char *str;
-     register unsigned int len;
+is_reserved_cc (register const char *str, register unsigned int len)
 {
   static unsigned char lengthtable[] =
     {
@@ -211,7 +207,7 @@ is_reserved_cc (str, len)
       {"default", rw_case,}
     };
 
-  static short lookup[] =
+  static signed char lookup[] =
     {
       -1, -1, -1,  0,  1, -1, -1,  2,  3,  4,  5,  6,  7,  8,
        9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
@@ -222,20 +218,20 @@ is_reserved_cc (str, len)
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
     {
-      register int key = hash_cc (str, len);
+      register unsigned int key = hash_cc (str, len);
 
-      if (key <= MAX_HASH_VALUE && key >= 0)
+      if (key <= MAX_HASH_VALUE)
         {
-          register int index = lookup[key];
+          register int idx = lookup[key];
 
-          if (index >= 0)
+          if (idx >= 0)
             {
-              if (len == lengthtable[index])
+              if (len == lengthtable[idx])
                 {
-                  register const char *s = wordlist[index].rwd;
+                  register const char *s = wordlist[idx].rwd;
 
                   if (*str == *s && !memcmp (str + 1, s + 1, len - 1))
-                    return &wordlist[index];
+                    return &wordlist[idx];
                 }
             }
         }
diff --git a/src/gperf.c b/src/gperf.c
index b755619..130b0e6 100644
--- a/src/gperf.c
+++ b/src/gperf.c
@@ -1,5 +1,5 @@
-/* C code produced by gperf version 3.0.3 */
-/* Command-line: gperf -D -c -l -p -t -T -g -j1 -o -K rwd -N is_reserved 
indent.gperf  */
+/* ANSI-C code produced by gperf version 3.0.4 */
+/* Command-line: gperf -D -c -l -p -t -T -g -j1 -o -K rwd -L ANSI-C -N 
is_reserved indent.gperf  */
 /* Computed positions: -k'2-3' */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -26,7 +26,7 @@
       && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
       && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
 /* The character set is not based on ISO-646.  */
-error "gperf generated tables don't work with this execution character set. 
Please report a bug to <address@hidden>."
+#error "gperf generated tables don't work with this execution character set. 
Please report a bug to <address@hidden>."
 #endif
 
 
@@ -45,9 +45,7 @@ inline
 #endif
 #endif
 static unsigned int
-hash (str, len)
-     register const char *str;
-     register unsigned int len;
+hash (register const char *str, register unsigned int len)
 {
   static unsigned char asso_values[] =
     {
@@ -78,7 +76,7 @@ hash (str, len)
       42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
       42, 42, 42, 42, 42, 42
     };
-  register int hval = len;
+  register unsigned int hval = len;
 
   switch (hval)
     {
@@ -94,14 +92,12 @@ hash (str, len)
 
 #ifdef __GNUC__
 __inline
-#ifdef __GNUC_STDC_INLINE__
+#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
 __attribute__ ((__gnu_inline__))
 #endif
 #endif
 templ_ty *
-is_reserved (str, len)
-     register const char *str;
-     register unsigned int len;
+is_reserved (register const char *str, register unsigned int len)
 {
   static unsigned char lengthtable[] =
     {
@@ -177,7 +173,7 @@ is_reserved (str, len)
       {"default", rw_case,}
     };
 
-  static short lookup[] =
+  static signed char lookup[] =
     {
       -1, -1, -1,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,
       11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
@@ -186,20 +182,20 @@ is_reserved (str, len)
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
     {
-      register int key = hash (str, len);
+      register unsigned int key = hash (str, len);
 
-      if (key <= MAX_HASH_VALUE && key >= 0)
+      if (key <= MAX_HASH_VALUE)
         {
-          register int index = lookup[key];
+          register int idx = lookup[key];
 
-          if (index >= 0)
+          if (idx >= 0)
             {
-              if (len == lengthtable[index])
+              if (len == lengthtable[idx])
                 {
-                  register const char *s = wordlist[index].rwd;
+                  register const char *s = wordlist[idx].rwd;
 
                   if (*str == *s && !memcmp (str + 1, s + 1, len - 1))
-                    return &wordlist[index];
+                    return &wordlist[idx];
                 }
             }
         }
diff --git a/src/lexi.c b/src/lexi.c
index 326b7e3..99cc431 100644
--- a/src/lexi.c
+++ b/src/lexi.c
@@ -205,6 +205,8 @@ int main (void)
 #endif
 
 /* Include code generated by gperf */
+templ_ty *
+is_reserved(register const char *str, register unsigned int len);
 #include "gperf.c"
 
 /* Include code generated by gperf for C++ keyword set */
@@ -214,6 +216,8 @@ int main (void)
 #undef MIN_WORD_LENGTH
 #undef MAX_WORD_LENGTH
 
+templ_ty *
+is_reserved_cc(register const char *str, register unsigned int len);
 #include "gperf-cc.c"
 
 /**
-- 
2.3.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]