diff options
author | Jon Grant <04@jguk.org> | 2010-04-29 17:42:54 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2010-04-29 17:42:54 +0000 |
commit | 7c6d86cc0701c963b5cc8fd6cac8cd1f1be3992c (patch) | |
tree | c94b2a869151dcadbd829d86a475c5322044156d /gcc | |
parent | 55040b34cd2888f14e0ae0566d6d193572284341 (diff) | |
download | gcc-7c6d86cc0701c963b5cc8fd6cac8cd1f1be3992c.zip gcc-7c6d86cc0701c963b5cc8fd6cac8cd1f1be3992c.tar.gz gcc-7c6d86cc0701c963b5cc8fd6cac8cd1f1be3992c.tar.bz2 |
collect2.c (vflag): Change type from int to bool.
2010-04-29 Jon Grant <04@jguk.org>
* collect2.c (vflag): Change type from int to bool.
(debug): Likewise.
(helpflag): New global bool.
(main): Set vflag and debug with boolean, not integer truth
values. Accept new "--help" option and output usage text if
found.
* collect2.h (vflag): Update prototype.
(debug): Likewise.
From-SVN: r158908
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/collect2.c | 29 | ||||
-rw-r--r-- | gcc/collect2.h | 2 |
3 files changed, 36 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 23f10f3..4d6cdfa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2010-04-29 Jon Grant <04@jguk.org> + + * collect2.c (vflag): Change type from int to bool. + (debug): Likewise. + (helpflag): New global bool. + (main): Set vflag and debug with boolean, not integer truth + values. Accept new "--help" option and output usage text if + found. + * collect2.h (vflag): Update prototype. + (debug): Likewise. + 2010-04-29 H.J. Lu <hongjiu.lu@intel.com> PR bootstrap/43935 diff --git a/gcc/collect2.c b/gcc/collect2.c index 481f739..6b2bb50 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -178,7 +178,7 @@ struct head int number; }; -int vflag; /* true if -v */ +bool vflag; /* true if -v or --version */ static int rflag; /* true if -r */ static int strip_flag; /* true if -s */ static const char *demangle_flag; @@ -197,7 +197,8 @@ enum lto_mode_d { /* Current LTO mode. */ static enum lto_mode_d lto_mode = LTO_MODE_NONE; -int debug; /* true if -debug */ +bool debug; /* true if -debug */ +bool helpflag; /* true if --help */ static int shared_obj; /* true if -shared */ @@ -1243,7 +1244,7 @@ main (int argc, char **argv) for (i = 1; argv[i] != NULL; i ++) { if (! strcmp (argv[i], "-debug")) - debug = 1; + debug = true; else if (! strcmp (argv[i], "-flto") && ! use_plugin) { use_verbose = true; @@ -1473,7 +1474,7 @@ main (int argc, char **argv) if (use_verbose && *q == '-' && q[1] == 'v' && q[2] == 0) { /* Turn on trace in collect2 if needed. */ - vflag = 1; + vflag = true; } } obstack_free (&temporary_obstack, temporary_firstobj); @@ -1603,7 +1604,7 @@ main (int argc, char **argv) case 'v': if (arg[2] == '\0') - vflag = 1; + vflag = true; break; case '-': @@ -1634,6 +1635,10 @@ main (int argc, char **argv) } else if (strncmp (arg, "--sysroot=", 10) == 0) target_system_root = arg + 10; + else if (strncmp (arg, "--version", 9) == 0) + vflag = true; + else if (strncmp (arg, "--help", 9) == 0) + helpflag = true; break; } } @@ -1735,6 +1740,20 @@ main (int argc, char **argv) fprintf (stderr, "\n"); } + if (helpflag) + { + fprintf (stderr, "Usage: collect2 [options]\n"); + fprintf (stderr, " Wrap linker and generate constructor code if needed.\n"); + fprintf (stderr, " Options:\n"); + fprintf (stderr, " -debug Enable debug output\n"); + fprintf (stderr, " --help Display this information\n"); + fprintf (stderr, " -v, --version Display this program's version number\n"); + fprintf (stderr, "Overview: http://gcc.gnu.org/onlinedocs/gccint/Collect2.html\n"); + fprintf (stderr, "Report bugs: %s\n", bug_report_url); + + collect_exit (0); + } + if (debug) { const char *ptr; diff --git a/gcc/collect2.h b/gcc/collect2.h index d9ffff1..e20cc43 100644 --- a/gcc/collect2.h +++ b/gcc/collect2.h @@ -39,7 +39,7 @@ extern const char *lderrout; extern const char *c_file_name; extern struct obstack temporary_obstack; extern char *temporary_firstobj; -extern int vflag, debug; +extern bool vflag, debug; extern void error (const char *, ...) ATTRIBUTE_PRINTF_1; extern void notice_translated (const char *, ...) ATTRIBUTE_PRINTF_1; |