Use exit rather than returning from main, for consistency on VMS.
Call as_fatal instead of as_bad or as_warn followed by exit.
Tue Sep 13 16:20:36 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
+ * config/tc-sparc.c (sparc_ip): Replace as_bad/exit sequence with
+ a call to as_fatal.
+ * config/tc-i860.c (i860_ip): Ditto.
+ * config/tc-hppa.c (pa_ip): Ditto.
+ * config/tc-alpha.c (alpha_ip): Ditto.
+ * as.c (parse_args): Ditto.
+
+ * config/tc-mips.c (mips_ip): Replace as_warn/exit sequence with a
+ call to as_fatal.
+
+ * write.c (write_contents): Use EXIT_FAILURE.
+ * output-file.c (output_file_create, output_file_close,
+ output_file_create, output_file_close): Ditto.
+ * messages.c (as_fatal): Ditto.
+ * config/obj-som.c (obj_som_version, obj_som_copyright): Ditto.
+ * config/obj-ieee.c (write_object_file): Ditto.
+ * config/obj-coff.c (write_object_file): Ditto.
+ * config/tc-vax.c (main): Use EXIT_SUCCESS.
+ * config/tc-m68k.c (main): Ditto.
+
+ * hash.c (main): Pass a value to exit().
+
+ * as.h (EXIT_SUCCESS, EXIT_FAILURE): Moved here.
+ * as.c: ...from here.
+ (parse_args): Use them always.
+ (main): Use exit rather than return.
+
* Makefile.in (*_FOR_TARGET, INSTALL_XFORM, install, uninstall):
Rewrite handling of program_transform_name.
#endif
static void perform_an_assembly_pass PARAMS ((int argc, char **argv));
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS 0
-#define EXIT_FAILURE 1
-#endif
-
int listing; /* true if a listing is wanted */
char *myname; /* argv[0] */
segT text_section, data_section, bss_section;
#endif
-/* This is true if the assembler should output time and space usage. */
-
-static int statistics_flag = 0;
-
\f
void
print_version_id ()
struct option *longopts;
extern struct option md_longopts[];
extern size_t md_longopts_size;
- static struct option std_longopts[] = {
+ static const struct option std_longopts[] = {
#define OPTION_HELP (OPTION_STD_BASE)
{"help", no_argument, NULL, OPTION_HELP},
#define OPTION_NOCPP (OPTION_STD_BASE + 1)
{"statistics", no_argument, NULL, OPTION_STATISTICS},
#define OPTION_VERSION (OPTION_STD_BASE + 3)
{"version", no_argument, NULL, OPTION_VERSION},
+#define OPTION_DUMPCONFIG (OPTION_STD_BASE + 4)
+ {"dump-config", no_argument, NULL, OPTION_DUMPCONFIG},
};
/* Construct the option lists from the standard list and the
case OPTION_HELP:
show_usage (stdout);
- exit (0);
+ exit (EXIT_SUCCESS);
case OPTION_NOCPP:
break;
case OPTION_STATISTICS:
- statistics_flag = 1;
+ flag_print_statistics = 1;
break;
case OPTION_VERSION:
print_version_id ();
- exit (0);
+ exit (EXIT_SUCCESS);
+
+ case OPTION_DUMPCONFIG:
+ fprintf (stderr, "alias = %s\n", TARGET_ALIAS);
+ fprintf (stderr, "canonical = %s\n", TARGET_CANONICAL);
+ fprintf (stderr, "cpu-type = %s\n", TARGET_CPU);
+#ifdef TARGET_OBJ_FORMAT
+ fprintf (stderr, "format = %s\n", TARGET_OBJ_FORMAT);
+#endif
+#ifdef TARGET_FORMAT
+ fprintf (stderr, "bfd-target = %s\n", TARGET_FORMAT);
+#endif
+ exit (EXIT_SUCCESS);
case 'v':
print_version_id ();
listing |= LISTING_SYMBOLS;
break;
default:
- as_bad ("invalid listing option `%c'", *optarg);
- exit (EXIT_FAILURE);
+ as_fatal ("invalid listing option `%c'", *optarg);
break;
}
optarg++;
#ifdef HOST_SPECIAL_INIT
HOST_SPECIAL_INIT (argc, argv);
#endif
-
+
#if 0 /* do we need any of this?? */
{
static const int sig[] = {SIGHUP, SIGINT, SIGPIPE, SIGTERM, 0};
md_end ();
#endif
- if (statistics_flag)
+ if (flag_print_statistics)
{
extern char **environ;
char *lim = (char *) sbrk (0);
myname, (long) (lim - (char *) &environ));
}
+ /* Use exit instead of return, because under VMS environments they
+ may not place the same interpretation on the value given. */
if ((had_warnings () && flag_always_generate_output)
|| had_errors () > 0)
- return EXIT_FAILURE;
- return EXIT_SUCCESS;
+ exit (EXIT_FAILURE);
+ exit (EXIT_SUCCESS);
}
\f
* If TEST is #defined, then we are testing a module: #define COMMON as "".
*/
-/* These #defines are for parameters of entire assembler. */
+#include "config.h"
-/* For some systems, this is required to be first. */
-#include "libiberty/alloca-conf.h"
+/* This is the code recommended in the autoconf documentation --
+ verbatim. If it doesn't work for you, let me know, and notify
+ djm@gnu.ai.mit.edu as well. */
+/* AIX requires this to be the first thing in the file. */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+#endif
/* Now, tend to the rest of the configuration. */
-#include "config.h"
/* System include files first... */
#include <stdio.h>
#include "fopen-same.h"
#endif
-/* This doesn't get taken care of by ansidecl.h. */
-#if !defined (__STDC__) && !defined (volatile)
-#define volatile
-#endif
-
/* This doesn't get taken care of anywhere. */
#if !defined (__GNUC__) && !defined (inline)
#define inline
extern void free ();
#endif
+#ifdef USE_DELETE_FOR_UNLINK
+#define unlink delete
+#endif
+
#ifdef BFD_ASSEMBLER
/* This one doesn't get declared, but we're using it anyways. This
should be fixed -- either it's part of the external interface or
#endif
#endif
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+#endif
+
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free xfree
if (abfd == 0)
{
as_perror ("FATAL: Can't create %s", out_file_name);
- exit (42);
+ exit (EXIT_FAILURE);
}
bfd_set_format (abfd, bfd_object);
bfd_set_arch_mach (abfd, BFD_ARCH, machine);
if (abfd == 0)
{
as_perror ("FATAL: Can't create %s", out_file_name);
- exit (42);
+ exit (EXIT_FAILURE);
}
bfd_set_format (abfd, bfd_object);
bfd_set_arch_mach (abfd, bfd_arch_h8300, 0);
break;
default:
- as_bad ("Unknown opcode: `%s'", str);
- exit (1);
+ as_fatal ("Unknown opcode: `%s'", str);
}
save_s = str;
S_SET_SEGMENT (symbol, &bfd_und_section);
S_SET_EXTERNAL (symbol);
- /* Keep this until we verify that the generic resolving
- code in write.c is fixed. */
- symbol->sy_resolved = 1;
-
+ /* colon() has already set the frag to the current location in the
+ $BSS$ subspace; we need to reset the fragment to the zero address
+ fragment. */
+ symbol->sy_frag = &zero_address_frag;
}
}
demand_empty_rest_of_line ();
break;
default:
- as_warn ("Unknown opcode: `%s'", str);
- exit (1);
+ as_fatal ("Unknown opcode: `%s'", str);
}
if ((insn = (struct mips_opcode *) hash_find (op_hash, str)) == NULL)
{
expP->X_add_number = floatP->low[0]
| ((LITTLENUM_MASK & (floatP->low[1])) << LITTLENUM_NUMBER_OF_BITS);
/*
- * For the SEG_BIG case we have:
+ * For the O_big case we have:
* If vop_short == 's' then a short floating literal is in the
* lowest 6 bits of floatP -> low [0], which is
* big_operand_bits [---] [0].
this_add_symbol = expP->X_add_symbol;
to_seg = *segP;
is_undefined = (to_seg == SEG_UNKNOWN);
- know (to_seg == SEG_UNKNOWN
- || to_seg == SEG_ABSOLUTE
- || to_seg == SEG_DATA
- || to_seg == SEG_TEXT
- || to_seg == SEG_BSS
- || to_seg == SEG_BIG);
at = operandP->vop_mode & 1;
length = (operandP->vop_short == 'b'
? 1 : (operandP->vop_short == 'w'
}
}
vip_end ();
- exit ();
+ exit (EXIT_SUCCESS);
}
#endif /* #ifdef test */
fflush (stdout);
gets (answer);
if (!answer[0])
- exit (0);
+ exit (EXIT_SUCCESS);
myaccess = answer[0];
mywidth = answer[1];
switch (mywidth)