]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Don't use C99 flexible array types as we want to be C89
authorGary V. Vaughan <gary@gnu.org>
Wed, 1 Sep 2004 01:22:26 +0000 (01:22 +0000)
committerGary V. Vaughan <gary@gnu.org>
Wed, 1 Sep 2004 01:22:26 +0000 (01:22 +0000)
compatible.  Instead, revert to the old way of doing things with
an array of symbol name vs. address, and adding the originator as
the first symbol but with a NULL address:

* config/ltmain.in (func_extract_dlsyms): Store originator as a
NULL address symbol.
* libltdl/ltdl.h (lt_dlsymbol): Removed.
(lt_dlsymlist): Remove originator field.
(LTDL_SET_PRELOADED_SYMBOLS): Adjust.
* libltdl/loaders/preopen.c (vm_open, lt_dlpreload_open): Adjust
for new types.
(vm_sym): Skip the new originator symbol when scanning symbol
names.
* m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Adjust preloaded symbols
test file to match.
* NEWS: Updated.

ChangeLog
NEWS
config/ltmain.in
libltdl/loaders/preopen.c
libltdl/ltdl.h
m4/libtool.m4

index bae003b8a9320d55a00ab80e8a8455bee9df8364..ca95eba4abfe1ca18611b3ce94009184ef1d922b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2004-09-01  Gary V. Vaughan  <gary@gnu.org>
+
+       Don't use C99 flexible array types as we want to be C89
+       compatible.  Instead, revert to the old way of doing things with
+       an array of symbol name vs. address, and adding the originator as
+       the first symbol but with a NULL address:
+
+       * config/ltmain.in (func_extract_dlsyms): Store originator as a
+       NULL address symbol.
+       * libltdl/ltdl.h (lt_dlsymbol): Removed.
+       (lt_dlsymlist): Remove originator field.
+       (LTDL_SET_PRELOADED_SYMBOLS): Adjust.
+       * libltdl/loaders/preopen.c (vm_open, lt_dlpreload_open): Adjust
+       for new types.
+       (vm_sym): Skip the new originator symbol when scanning symbol
+       names.
+       * m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Adjust preloaded symbols
+       test file to match.
+       * NEWS: Updated.
+
 2004-09-01  Gary V. Vaughan  <gary@gnu.org>
 
        Libtool currently assumes that certain characteristics, such as
diff --git a/NEWS b/NEWS
index 343a23d1c89c10c1850bdf14cc13cf4ba980776b..272475a1c29fe52c52d35aad005fece67fcb0833 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ NEWS - list of user-visible changes between releases of GNU Libtool
 
 New in 1.9d: 2004-??-??; CVS version 1.9c, Libtool team:
 * Return type of lt_dlloader_remove is no longer `const'.
+* libltdl is C89 compatible again.  lt_dlsymbol type removed, and lt_dlsymlist
+  structure changed to avoid using C99 flexible arrays.
 \f
 New in 1.9b: 2004-08-29; CVS version 1.5a, Libtool team:
 * The /^_?LT_[A-Z_]+$/ namespace is now reserved for Libtool's own macros.
index ba9c09b570fee47108c1854f920816eacecd50cb..29395ac4fe0ad160405a849b5dfa7033f7a45a27 100644 (file)
@@ -962,23 +962,18 @@ extern \"C\" {
 
 /* The mapping between symbol names and symbols.  */
 const struct {
-  const char *originator;
-  const struct {
-    const char *name;
-    void *address;
-  } symbols[];
+   const char *name;
+   void *address;
 }
-lt_${my_prefix}_LTX_preloaded_symbols =
+lt_${my_prefix}_LTX_preloaded_symbols[] =
 {\
-  \"$my_originator\",
-  {
+  { \"$my_originator\", (void *) 0 },
 "
 
          eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
 
          $echo >> "$output_objdir/$my_dlsyms" "\
   {0, (void *) 0}
-  }
 };
 
 /* This works around a problem in FreeBSD linker */
index 958c5a4e3f6377440fdad2fd15016a5ff1641d8f..a9b3668537fe9a50a886626a1b3f6ea2cfff4f41 100644 (file)
@@ -158,8 +158,8 @@ vm_open (lt_user_data loader_data, const char *filename)
 
   for (lists = preloaded_symlists; lists; lists = lists->next)
     {
-      const lt_dlsymbol *symbol;
-      for (symbol= lists->symlist->symbols; symbol->name; ++symbol)
+      const lt_dlsymlist *symbol;
+      for (symbol= lists->symlist; symbol->name; ++symbol)
        {
          if (!symbol->address && streq (symbol->name, filename))
            {
@@ -192,10 +192,9 @@ vm_close (lt_user_data loader_data, lt_module module)
 static void *
 vm_sym (lt_user_data loader_data, lt_module module, const char *name)
 {
-  lt_dlsymlist        *symlist = (lt_dlsymlist*) module;
-  const lt_dlsymbol    *symbol  = symlist->symbols;
+  lt_dlsymlist        *symbol = (lt_dlsymlist*) module;
 
-  ++symbol;                    /* Skip header. */
+  symbol +=2;                  /* Skip header (originator then libname). */
 
   while (symbol->name)
     {
@@ -320,15 +319,16 @@ 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 (streq (list->symlist->originator, originator))
+      if (streq (list->symlist->name, originator))
        {
-         const lt_dlsymbol *symbol;
+         const lt_dlsymlist *symbol;
          unsigned int idx = 0;
 
          ++found;
 
-         /* ...load the symbols per source compilation unit:  */
-         while ((symbol = &list->symlist->symbols[idx++])->name != 0)
+         /* ...load the symbols per source compilation unit:
+            (we preincrement the index to skip over the originator entry)  */
+         while ((symbol = &list->symlist[++idx])->name != 0)
            {
              if ((symbol->address == 0)
                  && (strneq (symbol->name, "@PROGRAM@")))
index fd56505bedecb4235b7843fdf9969c5549e5f91a..dcf88b2d25367700522608a07459d2b120c24aae 100644 (file)
@@ -84,11 +84,6 @@ LT_SCOPE int     lt_dlisresident     (lt_dlhandle handle);
 typedef struct {
   const char *name;
   void       *address;
-} lt_dlsymbol;
-
-typedef struct {
-  const char    *originator;
-  const lt_dlsymbol symbols[];
 } lt_dlsymlist;
 
 typedef int lt_dlpreload_callback_func (lt_dlhandle handle);
@@ -100,8 +95,8 @@ LT_SCOPE int lt_dlpreload_open    (const char *originator,
 
 #define lt_preloaded_symbols   lt__PROGRAM__LTX_preloaded_symbols
 #define LTDL_SET_PRELOADED_SYMBOLS()                   LT_STMT_START{  \
-       extern const lt_dlsymlist lt_preloaded_symbols;                 \
-       lt_dlpreload_default(&lt_preloaded_symbols);                    \
+       extern const lt_dlsymlist lt_preloaded_symbols[];               \
+       lt_dlpreload_default(lt_preloaded_symbols);                     \
                                                        }LT_STMT_END
 
 
index c4f1364b418b42cc1bf7bd39f1546e53970af3cc..633eb67d65ba8762e914c301d03781ffb61b6b51 100644 (file)
@@ -2793,21 +2793,16 @@ _LT_EOF
 
 /* The mapping between symbol names and symbols.  */
 const struct {
-  const char *originator;
-  const struct {
-    const char *name;
-    void       *address;
-  } symbols[[]];
+  const char *name;
+  void       *address;
 }
-lt__PROGRAM__LTX_preloaded_symbols =
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
 {
-  "@PROGRAM@",
-  {
+  { "@PROGRAM@", (void *) 0 },
 _LT_EOF
          $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
          cat <<\_LT_EOF >> conftest.$ac_ext
   {0, (void *) 0}
-  }
 };
 
 /* This works around a problem in FreeBSD linker */