From f2224fe2496e8723da2a39a3bf38ac3eb9bfe685 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Tue, 24 Jan 1995 21:56:29 +0000 Subject: [PATCH] "gcc -fno-builtin -Wall -Wwrite-strings -Wshadow" can be your friend. Well, sometimes. Bunch of patches from Pat Rankin for cleaning up some warnings in vax-vms gas. --- gas/ChangeLog | 37 +++++++++++++++++++++++++++++++++++++ gas/config/obj-vms.c | 15 ++++++++------- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 9e30a86fc4..858410219f 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,40 @@ +Tue Jan 24 16:44:23 1995 Ken Raeburn + + * config/tc-vax.c (vip): Introduce new ptr-to-const local variable + for scanning operand string. + + Sat Jan 21 17:50:38 1995 Pat Rankin (rankin@eql.caltech.edu) + + * config/vax-inst.h (struct vop, fields `vop_warn', `vop_error'): + make them pointers to const char; + (struct vit, field `vit_error'): ditto. + * config/atof-vax.c (md_atof): rename local `littlenum_pointer' + to `littlenumP' to avoid shadowing file scope variable. + * config/tc-vax.c (vip_begin, vip_op_defaults, vip_op_1): make + string arguments be pointers to const char; + (vip): make `alloperr' const char *; + (vip_op): make `err' and `wrn' const char *; rename `access' to + `access_mode' to avoid shadowing library function. + * config/obj-vms.c (`symbol_name'): make it const char *; + (get_struct_name): cast one use of `symbol_name' to char * + [caller guarantees that it won't modify the pointer's target]; + (PUT_COUNTED_STRING): use pointer to const char; + (VMS_typedef_parse): make `pnt2' const char *; + (Write_VMS_MHD_Records): make `cp' const char *; + (VMS_Modify_Psect_Attributes, array `Attributes'): make const, + and make field `Name' pointer to const char; + + * as.h (`seg_name[]' declaration): pointers to const char; + (struct _pseudo_type, field `poc_name'): pointer to const char. + * subsegs.c (`seg_name[]' definition): ditto; + * hash.c (hash_ask): rename argument `access' to `access_type' + to avoid shadowing library function. + * write.c (variable `the_object_file'): move from file scope + to block scope within write_object_file(); free it after use; + (fixup_segment): conditionally exclude it for OBJ_VMS. + (cvt_frag_to_fill): rename argument `headers' to `headersP' + to avoid shadowing file scope variable. + Mon Jan 23 21:42:39 1995 Jeff Law (law@snake.cs.utah.edu) * config/tc-hppa.c (pa_ip, case 'D'): Fix typo which caused diff --git a/gas/config/obj-vms.c b/gas/config/obj-vms.c index 3e7931f6c9..5769854c91 100644 --- a/gas/config/obj-vms.c +++ b/gas/config/obj-vms.c @@ -168,7 +168,7 @@ struct forward_ref *f_ref_root = * This variable is used to keep track of the name of the symbol we are * working on while we are parsing the stabs directives. */ -static char *symbol_name; +static const char *symbol_name; /* We use this counter to assign numbers to all of the structures, unions * and enums that we define. When we actually declare a variable to the @@ -272,7 +272,7 @@ static int Current_Object_Record_Type; /* Type of record in above */ #define PUT_CHAR(val) Object_Record_Buffer[Object_Record_Offset++] = val #define PUT_COUNTED_STRING(cp) {\ - register char *p = cp; \ + register const char *p = cp; \ PUT_CHAR(strlen(p)); \ while (*p) PUT_CHAR(*p++);} @@ -1589,7 +1589,7 @@ get_struct_name (str) while ((*pnt != ':') && (*pnt != '\0')) pnt--; if (*pnt == '\0') - return symbol_name; + return (char *) symbol_name; *pnt-- = '\0'; while ((*pnt != ';') && (*pnt != '=')) pnt--; @@ -2438,7 +2438,7 @@ VMS_typedef_parse (str) { char *pnt; char *pnt1; - char *pnt2; + const char *pnt2; int i; int dtype; struct forward_ref *fpnt; @@ -3129,7 +3129,8 @@ get_VMS_time_on_unix (Now) static void Write_VMS_MHD_Records () { - register char *cp, *cp1; + register const char *cp; + register char *cp1; register int i; struct { @@ -3510,9 +3511,9 @@ VMS_Modify_Psect_Attributes (Name, Attribute_Pointer) register int i; register char *cp; int Negate; - static struct + static const struct { - char *Name; + const char *Name; int Value; } Attributes[] = { -- 2.34.1