aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlexander Monakov <amonakov@ispras.ru>2023-05-06 01:25:26 +0300
committerAlexander Monakov <amonakov@ispras.ru>2023-05-09 12:57:14 +0300
commit425198bb5d2e30aa5e1e756869a9e6d27e30fd72 (patch)
tree2073fed797fc5afd66867309ce639c36509e7832 /gcc
parent2ed6dd975d1da862a9bec991c9a60d8537169e3b (diff)
downloadgcc-425198bb5d2e30aa5e1e756869a9e6d27e30fd72.zip
gcc-425198bb5d2e30aa5e1e756869a9e6d27e30fd72.tar.gz
gcc-425198bb5d2e30aa5e1e756869a9e6d27e30fd72.tar.bz2
genmatch: clean up showUsage
Display usage more consistently and get rid of camelCase. gcc/ChangeLog: * genmatch.cc (showUsage): Reimplement as ... (usage): ...this. Adjust all uses. (main): Print usage when no arguments. Add missing 'return 1'.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/genmatch.cc21
1 files changed, 10 insertions, 11 deletions
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
index d5e56e2..baf9385 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -5301,13 +5301,12 @@ round_alloc_size (size_t s)
/* Construct and display the help menu. */
static void
-showUsage ()
+usage ()
{
- fprintf (stderr, "Usage: genmatch [--gimple] [--generic] "
- "[--header=<filename>] [--include=<filename>] [-v[v]] input "
- "[<outputfile>...]\n");
- fprintf (stderr, "\nWhen more then one outputfile is specified --header "
- "is required.\n");
+ const char *usage = "Usage:\n"
+ " %s [--gimple|--generic] [-v[v]] <input>\n"
+ " %s [options] [--include=FILE] --header=FILE <input> <output>...\n";
+ fprintf (stderr, usage, progname, progname);
}
/* Write out the correct include to the match-head fle containing the helper
@@ -5332,9 +5331,6 @@ main (int argc, char **argv)
progname = "genmatch";
- if (argc < 2)
- return 1;
-
bool gimple = true;
char *s_header_file = NULL;
char *s_include_file = NULL;
@@ -5359,14 +5355,17 @@ main (int argc, char **argv)
files.safe_push (argv[i]);
else
{
- showUsage ();
+ usage ();
return 1;
}
}
/* Validate if the combinations are valid. */
if ((files.length () > 1 && !s_header_file) || files.is_empty ())
- showUsage ();
+ {
+ usage ();
+ return 1;
+ }
if (!s_include_file)
s_include_file = s_header_file;