aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-sparc.c
diff options
context:
space:
mode:
authorDavid MacKenzie <djm@cygnus>1994-06-03 17:42:27 +0000
committerDavid MacKenzie <djm@cygnus>1994-06-03 17:42:27 +0000
commitf3d817d8b7dd2b45a294f2a2cb2a2eb4eed0af07 (patch)
treeabba03b98ddaacc2f7f940a5d16cd2f2bf10485b /gas/config/tc-sparc.c
parent172559ec3375efe6c3964670fe22c38255ee4280 (diff)
downloadgdb-f3d817d8b7dd2b45a294f2a2cb2a2eb4eed0af07.zip
gdb-f3d817d8b7dd2b45a294f2a2cb2a2eb4eed0af07.tar.gz
gdb-f3d817d8b7dd2b45a294f2a2cb2a2eb4eed0af07.tar.bz2
* as.c (show_usage): Remove target specific messages;
instead, call md_show_usage. (parse_args): Use getopt_long_only. Take pointers to argc and argv. (main): Pass parse_args pointers. * as.h: Remove 3 variables that are redundant with flagseen. * as.c, messages.c: Change their users to use flagseen. Define getopt stuff. * tc.h: Update md_parse_option decl. Add md_show_usage decl. * config/tc-*.c: Add md_shortopts, md_longopts, md_longopts_size, md_show_usage. Change calling convention for md_parse_option. Remove md_parse_long_option. * config/tc-ns32k.c: Rename `struct option' to `struct ns32k_option'. * config/tc-i386.h: Don't define md_parse_option.
Diffstat (limited to 'gas/config/tc-sparc.c')
-rw-r--r--gas/config/tc-sparc.c137
1 files changed, 84 insertions, 53 deletions
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 733e3d2..1691d3d 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -2191,7 +2191,7 @@ print_insn (insn)
fprintf (stderr, "}\n");
}
#endif
-
+
/*
* md_parse_option
* Invocation line includes a switch not recognized by the base assembler.
@@ -2228,74 +2228,105 @@ print_insn (insn)
* end-sanitize-v9
*/
-int
-md_parse_option (argP, cntP, vecP)
- char **argP;
- int *cntP;
- char ***vecP;
-{
- char *p;
- const char **arch;
+#ifdef OBJ_ELF
+CONST char *md_shortopts = "A:VQ:sq";
+#else
+CONST char *md_shortopts = "A:";
+#endif
+struct option md_longopts[] = {
+#define OPTION_BUMP (OPTION_MD_BASE)
+ {"bump", no_argument, NULL, OPTION_BUMP},
+#define OPTION_SPARC (OPTION_MD_BASE + 1)
+ {"sparc", no_argument, NULL, OPTION_SPARC},
+ {NULL, no_argument, NULL, 0}
+};
+size_t md_longopts_size = sizeof(md_longopts);
- if (!strcmp (*argP, "bump"))
+int
+md_parse_option (c, arg)
+ int c;
+ char *arg;
+{
+ switch (c)
{
+ case OPTION_BUMP:
warn_on_bump = 1;
- }
- else if (**argP == 'A')
- {
- p = (*argP) + 1;
+ break;
- for (arch = architecture_pname; *arch != NULL; ++arch)
- {
- if (strcmp (p, *arch) == 0)
- {
+ case 'A':
+ {
+ char *p = arg;
+ const char **arch;
+
+ for (arch = architecture_pname; *arch != NULL; ++arch)
+ {
+ if (strcmp (p, *arch) == 0)
break;
- } /* found a match */
- } /* walk the pname table */
+ }
+
+ if (*arch == NULL)
+ {
+ as_bad ("invalid architecture -A%s", p);
+ return 0;
+ }
+ else
+ {
+ current_architecture = (enum sparc_architecture)
+ (arch - architecture_pname);
+ architecture_requested = 1;
+ }
+ }
+ break;
+
+ case OPTION_SPARC:
+ /* Ignore -sparc, used by SunOS make default .s.o rule. */
+ break;
- if (*arch == NULL)
- {
- as_bad ("unknown architecture: %s", p);
- }
- else
- {
- current_architecture = (enum sparc_architecture) (arch - architecture_pname);
- architecture_requested = 1;
- }
- }
#ifdef OBJ_ELF
- else if (**argP == 'V')
- {
+ case 'V':
print_version_id ();
- }
- else if (**argP == 'Q')
- {
+ break;
+
+ case 'Q':
/* Qy - do emit .comment
Qn - do not emit .comment */
- }
- else if (**argP == 's')
- {
+ break;
+
+ case 's':
/* use .stab instead of .stab.excl */
- }
- else if (**argP == 'q')
- {
+ break;
+
+ case 'q':
/* quick -- native assembler does fewer checks */
- }
+ break;
#endif
- else if (strcmp (*argP, "sparc") == 0)
- {
- /* Ignore -sparc, used by SunOS make default .s.o rule. */
- }
- else
- {
- /* Unknown option */
- (*argP)++;
+
+ default:
return 0;
}
- **argP = '\0'; /* Done parsing this switch */
- return 1;
-} /* md_parse_option() */
+ return 1;
+}
+
+void
+md_show_usage (stream)
+ FILE *stream;
+{
+ fprintf(stream, "\
+SPARC options:\n\
+-Av6 | -Av7 | -Av8 | -Asparclite\n\
+ specify variant of SPARC architecture\n\
+-bump warn when assembler switches architectures\n\
+-sparc ignored\n");
+#ifdef OBJ_ELF
+ fprintf(stream, "\
+-V print assembler version number\n\
+-q ignored\n\
+-Qy, -Qn ignored\n\
+-s ignored\n");
+#endif
+}
+
/* We have no need to default values of symbols. */
/* ARGSUSED */