* options.h (DEFINE_var): Add set_user_set_##varname__.
authorIan Lance Taylor <ian@airs.com>
Tue, 6 May 2008 20:40:33 +0000 (20:40 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 6 May 2008 20:40:33 +0000 (20:40 +0000)
(DEFINE_bool_alias): New macro.
(class General_options): Define -Bstatic using DEFINE_bool_alias
rather than DEFINE_special.  Add --undefined as an alias for -z
defs.
* options.cc (General_options::parse_Bstatic): Remove.

gold/ChangeLog
gold/options.cc
gold/options.h

index 3f77ed430784aad1bfea3808a47e3edba467df60..3c015c8acd018e0c0a4be68c2b999d7fda541d0b 100644 (file)
@@ -1,5 +1,12 @@
 2008-05-06  Ian Lance Taylor  <iant@google.com>
 
+       * options.h (DEFINE_var): Add set_user_set_##varname__.
+       (DEFINE_bool_alias): New macro.
+       (class General_options): Define -Bstatic using DEFINE_bool_alias
+       rather than DEFINE_special.  Add --undefined as an alias for -z
+       defs.
+       * options.cc (General_options::parse_Bstatic): Remove.
+
        * options.h (class General_options): Add --fatal-warnings.
        * main.cc (main): Implement --fatal-warnings.
        * errors.h (Errors::warning_count): New function.
index af024b5c936664a2d5a2ac0d65df7f9214009d86..8d18c11fbc2f758445263c7a84b1ce7220877f90 100644 (file)
@@ -281,12 +281,6 @@ General_options::parse_V(const char*, const char*, Command_line*)
     printf("   %s\n", *p);
 }
 
-void
-General_options::parse_Bstatic(const char*, const char*, Command_line*)
-{
-  this->set_Bdynamic(false);
-}
-
 void
 General_options::parse_defsym(const char*, const char* arg,
                               Command_line* cmdline)
index 2ea57ecb01bac4983da56dd552fda5edaa1a9990..cf9b887f1c9360ae794b320230b4d3d9a6a86d65 100644 (file)
@@ -239,6 +239,10 @@ struct Struct_special : public Struct_var
   user_set_##varname__() const                                               \
   { return this->varname__##_.user_set_via_option; }                         \
                                                                              \
+  void                                                                      \
+  set_user_set_##varname__()                                                \
+  { this->varname__##_.user_set_via_option = true; }                        \
+                                                                            \
  private:                                                                    \
   struct Struct_##varname__ : public options::Struct_var                     \
   {                                                                          \
@@ -390,6 +394,53 @@ struct Struct_special : public Struct_var
                            choices, sizeof(choices) / sizeof(*choices)); \
   }
 
+// This is like DEFINE_bool, but VARNAME is the name of a different
+// option.  This option becomes an alias for that one.  INVERT is true
+// if this option is an inversion of the other one.
+#define DEFINE_bool_alias(option__, varname__, dashes__, shortname__,  \
+                         helpstring__, no_helpstring__, invert__)      \
+ private:                                                              \
+  struct Struct_##option__ : public options::Struct_var                        \
+  {                                                                    \
+    Struct_##option__()                                                        \
+      : option(#option__, dashes__, shortname__, "", helpstring__,     \
+              NULL, false, this)                                       \
+    { }                                                                        \
+                                                                       \
+    void                                                               \
+    parse_to_value(const char*, const char*,                           \
+                  Command_line*, General_options* options)             \
+    {                                                                  \
+      options->set_##varname__(!invert__);                             \
+      options->set_user_set_##varname__();                             \
+    }                                                                  \
+                                                                       \
+    options::One_option option;                                                \
+  };                                                                   \
+  Struct_##option__ option__##_;                                       \
+                                                                       \
+  struct Struct_no_##option__ : public options::Struct_var             \
+  {                                                                    \
+    Struct_no_##option__()                                             \
+      : option((dashes__ == options::DASH_Z                            \
+               ? "no" #option__                                        \
+               : "no-" #option__),                                     \
+              dashes__, '\0', "", no_helpstring__,                     \
+              NULL, false, this)                                       \
+    { }                                                                        \
+                                                                       \
+    void                                                               \
+    parse_to_value(const char*, const char*,                           \
+                  Command_line*, General_options* options)             \
+    {                                                                  \
+      options->set_##varname__(invert__);                              \
+      options->set_user_set_##varname__();                             \
+    }                                                                  \
+                                                                       \
+    options::One_option option;                                                \
+  };                                                                   \
+  Struct_no_##option__ no_##option__##_initializer_
+
 // This is used for non-standard flags.  It defines no functions; it
 // just calls General_options::parse_VARNAME whenever the flag is
 // seen.  We declare parse_VARNAME as a static member of
@@ -502,10 +553,9 @@ class General_options
 
   DEFINE_bool(Bdynamic, options::ONE_DASH, '\0', true,
               N_("-l searches for shared libraries"), NULL);
-  // Bstatic affects the same variable as Bdynamic, so we have to use
-  // the "special" macro to make that happen.
-  DEFINE_special(Bstatic, options::ONE_DASH, '\0',
-                 N_("-l does not search for shared libraries"), NULL);
+  DEFINE_bool_alias(Bstatic, Bdynamic, options::ONE_DASH, '\0',
+                   N_("-l does not search for shared libraries"), NULL,
+                   true);
 
   DEFINE_bool(Bsymbolic, options::ONE_DASH, '\0', false,
               N_("Bind defined symbols locally"), NULL);
@@ -683,6 +733,11 @@ class General_options
   DEFINE_uint64(Ttext, options::ONE_DASH, '\0', -1U,
                 N_("Set the address of the text segment"), N_("ADDRESS"));
 
+  DEFINE_bool_alias(undefined, defs, options::TWO_DASHES, '\0',
+                   "Allow undefined symbols with --shared",
+                   "Report undefined symbols (even with --shared)",
+                   true);
+
   DEFINE_bool(verbose, options::TWO_DASHES, '\0', false,
               N_("Synonym for --debug=files"), NULL);
 
This page took 0.034909 seconds and 4 git commands to generate.