]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
syntax-check: fix violations and re-enable sc_prohibit_strcmp.
authorGary V. Vaughan <gary@gnu.org>
Mon, 24 Oct 2011 14:36:27 +0000 (21:36 +0700)
committerGary V. Vaughan <gary@gnu.org>
Thu, 17 Nov 2011 12:21:10 +0000 (19:21 +0700)
* cfg.mk (local-checks-to-fix): Remove sc_prohibit_strcmp
from list of disabled checks.
(exclude_file_name_regexp--sc_prohibit_strcmp): Ignore
violations in libtool.texi and any demo C files.
* libltdl/libltdl/lt__private.h (strneq, streq): Renamed from
this...
(STRNEQ, STREQ): ..to this.  Adjust all callers.
* tests/slist.at: Add STREQ definition. Change all !strcmp calls
to STREQ.
* build-aux/ltmain.m4sh (func_emit_cwrapperexe_src): Add and use
STREQ definition.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
build-aux/ltmain.m4sh
cfg.mk
libltdl/libgnu/.gitignore [deleted file]
libltdl/libltdl/lt__private.h
libltdl/loaders/preopen.c
libltdl/lt_dlloader.c
libltdl/ltdl.c
tests/slist.at

index a661583334a03341dac7c2bd2f02758cf3c9027f..54fbca49b5c073ca6a10afeff0fcb8e04a8990ca 100644 (file)
@@ -3424,6 +3424,8 @@ EOF
 #include <fcntl.h>
 #include <sys/stat.h>
 
+#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
+
 /* declarations of non-ANSI functions */
 #if defined(__MINGW32__)
 # ifdef __STRICT_ANSI__
@@ -3620,7 +3622,7 @@ main (int argc, char *argv[])
   newargc=0;
   for (i = 1; i < argc; i++)
     {
-      if (strcmp (argv[i], dumpscript_opt) == 0)
+      if (STREQ (argv[i], dumpscript_opt))
        {
 EOF
            case "$host" in
@@ -3634,12 +3636,12 @@ EOF
          lt_dump_script (stdout);
          return 0;
        }
-      if (strcmp (argv[i], debug_opt) == 0)
+      if (STREQ (argv[i], debug_opt))
        {
           lt_debug = 1;
           continue;
        }
-      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+      if (STREQ (argv[i], ltwrapper_option_prefix))
         {
           /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
              namespace, but it is not one of the ones we know about and
@@ -4047,7 +4049,7 @@ strendzap (char *str, const char *pat)
   if (patlen <= len)
     {
       str += len - patlen;
-      if (strcmp (str, pat) == 0)
+      if (STREQ (str, pat))
        *str = '\0';
     }
   return str;
diff --git a/cfg.mk b/cfg.mk
index 17f362f175d5686b3bb5671582405b71ec849d53..fba8f2463b1f29c8fa6ad8cecd4c2bced67ff816 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -40,7 +40,6 @@ VC_LIST_ALWAYS_EXCLUDE_REGEX = ^mail/
 local-checks-to-fix =                          \
        sc_prohibit_always-defined_macros       \
        sc_prohibit_always_true_header_tests    \
-       sc_prohibit_strcmp                      \
        sc_prohibit_test_minus_ao               \
        sc_prohibit_undesirable_word_seq        \
        sc_require_config_h                     \
@@ -67,3 +66,5 @@ local-checks-to-skip =                                \
 # List syntax-check exempted files.
 exclude_file_name_regexp--sc_error_message_uppercase = \
   ^$(_build-aux)/cvsu$$
+exclude_file_name_regexp--sc_prohibit_strcmp = \
+  ^(doc/libtool.texi|tests/.*demo/.*\.c)$$
diff --git a/libltdl/libgnu/.gitignore b/libltdl/libgnu/.gitignore
deleted file mode 100644 (file)
index d9f5394..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/Makefile.am
-/dummy.c
index f4c4a3d7e32007b3c79b254413f7b2bec021e2bb..3b2609bca0fc6abda9712501b8729b6624643b45 100644 (file)
@@ -94,8 +94,8 @@ LT_SCOPE void lt__alloc_die_callback (void);
 
 
 /* For readability:  */
-#define strneq(s1, s2) (strcmp((s1), (s2)) != 0)
-#define streq(s1, s2)  (!strcmp((s1), (s2)))
+#define STRNEQ(s1, s2) (strcmp((s1), (s2)) != 0)
+#define STREQ(s1, s2)  (strcmp((s1), (s2)) == 0)
 
 
 
index 7149287d2037a94d4f719e4d32747bbc1867c2c0..1fe412718051ac01b571e954cb551a08bd61ad8e 100644 (file)
@@ -168,7 +168,7 @@ vm_open (lt_user_data LT__UNUSED loader_data, const char *filename,
       const lt_dlsymlist *symbol;
       for (symbol= lists->symlist; symbol->name; ++symbol)
        {
-         if (!symbol->address && streq (symbol->name, filename))
+         if (!symbol->address && STREQ (symbol->name, filename))
            {
              /* If the next symbol's name and address is 0, it means
                 the module just contains the originator and no symbols.
@@ -214,7 +214,7 @@ vm_sym (lt_user_data LT__UNUSED loader_data, lt_module module, const char *name)
 
   while (symbol->name)
     {
-      if (streq (symbol->name, name))
+      if (STREQ (symbol->name, name))
        {
          return symbol->address;
        }
@@ -336,8 +336,8 @@ lt_dlpreload_open (const char *originator, lt_dlpreload_callback_func *func)
   for (list = preloaded_symlists; list; list = list->next)
     {
       /* ...that was preloaded by the requesting ORIGINATOR... */
-      if ((originator && streq (list->symlist->name, originator))
-          || (!originator && streq (list->symlist->name, "@PROGRAM@")))
+      if ((originator && STREQ (list->symlist->name, originator))
+          || (!originator && STREQ (list->symlist->name, "@PROGRAM@")))
        {
          const lt_dlsymlist *symbol;
          unsigned int idx = 0;
@@ -349,7 +349,7 @@ lt_dlpreload_open (const char *originator, lt_dlpreload_callback_func *func)
          while ((symbol = &list->symlist[++idx])->name != 0)
            {
              if ((symbol->address == 0)
-                 && (strneq (symbol->name, "@PROGRAM@")))
+                 && (STRNEQ (symbol->name, "@PROGRAM@")))
                {
                  lt_dlhandle handle = lt_dlopen (symbol->name);
                  if (handle == 0)
index 2c99a22d486e2445dd86d574b5f7928469ac4883..699a5042ce717d0eae8c8989e13653c05fc1733b 100644 (file)
@@ -52,7 +52,7 @@ loader_callback (SList *item, void *userdata)
 
   assert (vtable);
 
-  return streq (vtable->name, name) ? (void *) item : NULL;
+  return STREQ (vtable->name, name) ? (void *) item : NULL;
 }
 
 
index 06f0f5aeb4d77ccfb3af7088539210707f2f93af..0887734a7b151a3780011ab03ce2c4e51c5e32ab 100644 (file)
@@ -385,7 +385,7 @@ tryall_dlopen (lt_dlhandle *phandle, const char *filename,
     {
       if ((handle->info.filename == filename) /* dlopen self: 0 == 0 */
          || (handle->info.filename && filename
-             && streq (handle->info.filename, filename)))
+             && STREQ (handle->info.filename, filename)))
        {
          break;
        }
@@ -1108,11 +1108,11 @@ parse_dotla_file(FILE *file, char **dlname, char **libdir, char **deplibs,
        {
          errors += trim (deplibs, &line[sizeof (STR_DL_DEPLIBS) - 1]);
        }
-      else if (streq (line, "installed=yes\n"))
+      else if (STREQ (line, "installed=yes\n"))
        {
          *installed = 1;
        }
-      else if (streq (line, "installed=no\n"))
+      else if (STREQ (line, "installed=no\n"))
        {
          *installed = 0;
        }
@@ -1324,7 +1324,7 @@ try_dlopen (lt_dlhandle *phandle, const char *filename, const char *ext,
     }
 
   /* Check whether we are opening a libtool module (.la extension).  */
-  if (ext && streq (ext, archive_ext))
+  if (ext && STREQ (ext, archive_ext))
     {
       /* this seems to be a libtool module */
       FILE *   file     = 0;
@@ -1538,12 +1538,12 @@ has_library_ext (const char *filename)
 
   ext = strrchr (filename, '.');
 
-  if (ext && ((streq (ext, archive_ext))
+  if (ext && ((STREQ (ext, archive_ext))
 #if defined(LT_MODULE_EXT)
-            || (streq (ext, shlib_ext))
+            || (STREQ (ext, shlib_ext))
 #endif
 #if defined(LT_SHARED_EXT)
-            || (streq (ext, shared_ext))
+            || (STREQ (ext, shared_ext))
 #endif
     ))
     {
@@ -2428,7 +2428,7 @@ lt_dlhandle_fetch (lt_dlinterface_id iface, const char *module_name)
   while ((handle = lt_dlhandle_iterate (iface, handle)))
     {
       lt_dlhandle cur = handle;
-      if (cur && cur->info.name && streq (cur->info.name, module_name))
+      if (cur && cur->info.name && STREQ (cur->info.name, module_name))
        break;
     }
 
index 741410c49839c4d2267ce129f8c8b17216c1154a..68907e63efabd3e4ea1398da03116421de6b91f3 100644 (file)
@@ -31,9 +31,11 @@ AT_DATA([test-slist.c], [[
 #include <stdio.h>
 #include "slist.h"
 
+#define STREQ(s1, s2)  (strcmp ((s1), (s2)) == 0)
+
 void *find_string (SList *item, void *data)
 {
-  if (data != NULL && !strcmp ((const char *) item->userdata, (const char *)data))
+  if (data != NULL && STREQ ((const char *) item->userdata, (const char *)data))
     return item;
   else
     return NULL;
@@ -83,10 +85,10 @@ int main ()
   assert (slist_find (list, find_string, (void *) "foo10") == NULL);
   item = (SList *) slist_find (list, find_string, (void *) "foo1");
   assert (item != NULL);
-  assert (!strcmp ((const char *) item->userdata, "foo1"));
+  assert (STREQ ((const char *) item->userdata, "foo1"));
 
   item = slist_nth (list, 10);
-  assert (item != NULL && !strcmp ((const char *) item->userdata, "foo0"));
+  assert (item != NULL && STREQ ((const char *) item->userdata, "foo0"));
 
   puts ("list as inserted:");
   slist_foreach (list, print_item, NULL);
@@ -95,13 +97,13 @@ int main ()
   slist_foreach (list, print_item, NULL);
 
   item = slist_nth (list, 1);
-  assert (item != NULL && !strcmp ((const char *) item->userdata, "foo0"));
+  assert (item != NULL && STREQ ((const char *) item->userdata, "foo0"));
 
   assert (10 == slist_length (list));
 
   /* slist_tail is the second item, not the last one */
   item = slist_tail (list);
-  assert (item != NULL && !strcmp ((const char *) item->userdata, "foo1"));
+  assert (item != NULL && STREQ ((const char *) item->userdata, "foo1"));
 
   assert (slist_tail (slist_nth (list, 10)) == NULL);
 
@@ -131,19 +133,19 @@ int main ()
   list_save = list;
   item = slist_remove (&list, find_string, (void *) "foo5");
   assert (list_save == list);
-  assert (item != NULL && !strcmp (data = (char *) slist_unbox (item), "foo5"));
+  assert (item != NULL && STREQ (data = (char *) slist_unbox (item), "foo5"));
   free (data);
 
   list_save = list;
   item = slist_remove (&list, find_string, (void *) "foo9");
   assert (list_save == list);
-  assert (item != NULL && !strcmp (data = (char *) slist_unbox (item), "foo9"));
+  assert (item != NULL && STREQ (data = (char *) slist_unbox (item), "foo9"));
   free (data);
 
   list_save = list;
   item = slist_remove (&list, find_string, (void *) "foo0");
   assert (list_save != list);
-  assert (item != NULL && !strcmp (data = (char *) slist_unbox (item), "foo0"));
+  assert (item != NULL && STREQ (data = (char *) slist_unbox (item), "foo0"));
   free (data);
 
   list_save = list;