diff options
author | Ken Raeburn <raeburn@cygnus> | 1994-09-13 23:07:48 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@cygnus> | 1994-09-13 23:07:48 +0000 |
commit | 460531dad97cd6bd25c62087dd111d1dfe4d20b9 (patch) | |
tree | 3ace4f91ccc4335ac10aad64b58afc3f8e519e49 | |
parent | 28d3e4a3f8aa6dbded562b67cedb3ad15474565d (diff) | |
download | gdb-460531dad97cd6bd25c62087dd111d1dfe4d20b9.zip gdb-460531dad97cd6bd25c62087dd111d1dfe4d20b9.tar.gz gdb-460531dad97cd6bd25c62087dd111d1dfe4d20b9.tar.bz2 |
Use EXIT_SUCCESS and EXIT_FAILURE in all exit calls.
Use exit rather than returning from main, for consistency on VMS.
Call as_fatal instead of as_bad or as_warn followed by exit.
-rw-r--r-- | gas/ChangeLog | 27 | ||||
-rw-r--r-- | gas/as.c | 44 | ||||
-rw-r--r-- | gas/as.h | 38 | ||||
-rw-r--r-- | gas/config/obj-coff.c | 2 | ||||
-rw-r--r-- | gas/config/obj-ieee.c | 2 | ||||
-rw-r--r-- | gas/config/tc-hppa.c | 11 | ||||
-rw-r--r-- | gas/config/tc-mips.c | 3 | ||||
-rw-r--r-- | gas/config/tc-vax.c | 12 |
8 files changed, 92 insertions, 47 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index afae00a..5cdec3c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,32 @@ 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. @@ -57,11 +57,6 @@ static SIGTY got_sig PARAMS ((int sig)); #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] */ @@ -70,10 +65,6 @@ segT reg_section, expr_section; 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; - void print_version_id () @@ -165,7 +156,7 @@ parse_args (pargc, pargv) 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) @@ -174,6 +165,8 @@ parse_args (pargc, pargv) {"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 @@ -226,18 +219,30 @@ parse_args (pargc, pargv) 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 (); @@ -289,8 +294,7 @@ parse_args (pargc, pargv) listing |= LISTING_SYMBOLS; break; default: - as_bad ("invalid listing option `%c'", *optarg); - exit (EXIT_FAILURE); + as_fatal ("invalid listing option `%c'", *optarg); break; } optarg++; @@ -352,7 +356,7 @@ main (argc, argv) #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}; @@ -424,7 +428,7 @@ main (argc, argv) md_end (); #endif - if (statistics_flag) + if (flag_print_statistics) { extern char **environ; char *lim = (char *) sbrk (0); @@ -436,10 +440,12 @@ main (argc, argv) 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); } @@ -35,13 +35,29 @@ * 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> @@ -104,11 +120,6 @@ extern char *strdup (/* const char * */); #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 @@ -123,6 +134,10 @@ extern PTR realloc (); 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 @@ -167,6 +182,11 @@ extern PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t sz)); #endif #endif +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 +#endif + #define obstack_chunk_alloc xmalloc #define obstack_chunk_free xfree diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index 5891616..960dcfd 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -2789,7 +2789,7 @@ write_object_file () 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); diff --git a/gas/config/obj-ieee.c b/gas/config/obj-ieee.c index a99ced2..4cd1794 100644 --- a/gas/config/obj-ieee.c +++ b/gas/config/obj-ieee.c @@ -509,7 +509,7 @@ DEFUN_VOID (write_object_file) 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); diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index 988edd9..ceecc47 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -1396,8 +1396,7 @@ pa_ip (str) break; default: - as_bad ("Unknown opcode: `%s'", str); - exit (1); + as_fatal ("Unknown opcode: `%s'", str); } save_s = str; @@ -4283,10 +4282,10 @@ pa_comm (unused) 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 (); diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 510e114..4033c4d 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -4132,8 +4132,7 @@ mips_ip (str, ip) 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) { diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c index abfc568..36a0afe 100644 --- a/gas/config/tc-vax.c +++ b/gas/config/tc-vax.c @@ -594,7 +594,7 @@ md_assemble (instruction_string) 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]. @@ -653,12 +653,6 @@ md_assemble (instruction_string) 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' @@ -1935,7 +1929,7 @@ main () } } vip_end (); - exit (); + exit (EXIT_SUCCESS); } #endif /* #ifdef test */ @@ -2982,7 +2976,7 @@ main () fflush (stdout); gets (answer); if (!answer[0]) - exit (0); + exit (EXIT_SUCCESS); myaccess = answer[0]; mywidth = answer[1]; switch (mywidth) |