yet more vms work

This commit is contained in:
Ken Raeburn
1995-08-01 01:41:53 +00:00
parent 5f57cea3f6
commit ac24997f36
2 changed files with 87 additions and 80 deletions

View File

@ -1,3 +1,12 @@
Mon Jul 31 21:40:47 1995 Ken Raeburn <raeburn@cygnus.com>
Sat Jul 29 18:55:23 1995 Pat Rankin <rankin@eql.caltech.edu>
* config/obj-vms.c (COPY_SHORT, COPY_LONG, PUT_SHORT, PUT_LONG):
Make expansion be safe for use in expressions.
(PUT_COUNTED_STRING): Bracket expansion with `do {...} while (0)'
rather than just `{...}'.
Mon Jul 31 18:19:26 1995 steve chamberlain <sac@slash.cygnus.com> Mon Jul 31 18:19:26 1995 steve chamberlain <sac@slash.cygnus.com>
* gasp.c (change_base): Don't modify numbers in strings. (pr7583) * gasp.c (change_base): Don't modify numbers in strings. (pr7583)

View File

@ -262,29 +262,29 @@ static int Current_Object_Record_Type; /* Type of record in above */
* Macros for moving data around. Must work on big-endian systems. * Macros for moving data around. Must work on big-endian systems.
*/ */
#ifdef VMS /* These are more efficient for VMS->VMS systems */ #ifdef VMS /* These are more efficient for VMS->VMS systems */
#define COPY_LONG(dest,val) {*(long *) dest = val; } #define COPY_LONG(dest,val) ( *(long *)(dest) = (val) )
#define COPY_SHORT(dest,val) {*(short *) dest = val; } #define COPY_SHORT(dest,val) ( *(short *)(dest) = (val) )
#else #else
#define COPY_LONG(dest,val) { md_number_to_chars(dest, val, 4); } #define COPY_LONG(dest,val) md_number_to_chars ((dest), (val), 4)
#define COPY_SHORT(dest,val) { md_number_to_chars(dest, val, 2); } #define COPY_SHORT(dest,val) md_number_to_chars ((dest), (val), 2)
#endif #endif
/* /*
* Macros for placing data into the object record buffer * Macros for placing data into the object record buffer
*/ */
#define PUT_LONG(val) \ #define PUT_LONG(val) \
{ COPY_LONG(&Object_Record_Buffer[Object_Record_Offset], val); \ ( COPY_LONG (&Object_Record_Buffer[Object_Record_Offset], (val)), \
Object_Record_Offset += 4; } Object_Record_Offset += 4 )
#define PUT_SHORT(val) \ #define PUT_SHORT(val) \
{ COPY_SHORT(&Object_Record_Buffer[Object_Record_Offset], val); \ ( COPY_SHORT (&Object_Record_Buffer[Object_Record_Offset], (val)), \
Object_Record_Offset += 2; } Object_Record_Offset += 2 )
#define PUT_CHAR(val) Object_Record_Buffer[Object_Record_Offset++] = val #define PUT_CHAR(val) ( Object_Record_Buffer[Object_Record_Offset++] = (val) )
#define PUT_COUNTED_STRING(cp) {\ #define PUT_COUNTED_STRING(cp) do { \
register const char *p = cp; \ register const char *p = (cp); \
PUT_CHAR(strlen(p)); \ PUT_CHAR ((char) strlen (p)); \
while (*p) PUT_CHAR(*p++);} while (*p) PUT_CHAR (*p++); } while (0)
/* /*
* Macro for determining if a Name has psect attributes attached * Macro for determining if a Name has psect attributes attached
@ -294,7 +294,7 @@ static int Current_Object_Record_Type; /* Type of record in above */
#define PSECT_ATTRIBUTES_STRING_LENGTH 18 #define PSECT_ATTRIBUTES_STRING_LENGTH 18
#define HAS_PSECT_ATTRIBUTES(Name) \ #define HAS_PSECT_ATTRIBUTES(Name) \
(strncmp((Name[0] == '_' ? Name + 1 : Name), \ (strncmp ((*Name == '_' ? Name + 1 : Name), \
PSECT_ATTRIBUTES_STRING, \ PSECT_ATTRIBUTES_STRING, \
PSECT_ATTRIBUTES_STRING_LENGTH) == 0) PSECT_ATTRIBUTES_STRING_LENGTH) == 0)
@ -439,6 +439,9 @@ const pseudo_typeS obj_pseudo_table[] =
{0, 0, 0}, {0, 0, 0},
}; /* obj_pseudo_table */ }; /* obj_pseudo_table */
/* Routine to perform RESOLVE_SYMBOL_REDEFINITION(). */
int int
vms_resolve_symbol_redef (sym) vms_resolve_symbol_redef (sym)
symbolS *sym; symbolS *sym;
@ -458,8 +461,7 @@ vms_resolve_symbol_redef (sym)
* If the old symbol is .comm and it has a size of zero, * If the old symbol is .comm and it has a size of zero,
* we override it with the new symbol value. * we override it with the new symbol value.
*/ */
if (S_IS_EXTERNAL(sym) && S_IS_DEFINED(sym) if (S_IS_EXTERNAL (sym) && S_IS_DEFINED (sym) && S_GET_VALUE (sym) == 0)
&& (S_GET_VALUE(sym) == 0))
{ {
as_warn ("compiler redefined zero-size common symbol `%s'", as_warn ("compiler redefined zero-size common symbol `%s'",
S_GET_NAME (sym)); S_GET_NAME (sym));
@ -1685,7 +1687,7 @@ find_symbol (dbx_type)
struct VMS_DBG_Symbol *spnt; struct VMS_DBG_Symbol *spnt;
spnt = VMS_Symbol_type_list[SYMTYP_HASH (dbx_type)]; spnt = VMS_Symbol_type_list[SYMTYP_HASH (dbx_type)];
while (spnt != (struct VMS_DBG_Symbol *) NULL) while (spnt)
{ {
if (spnt->dbx_type == dbx_type) if (spnt->dbx_type == dbx_type)
break; break;
@ -2505,8 +2507,8 @@ forward_reference (pnt)
pnt = (char *) strchr (pnt, ':'); pnt = (char *) strchr (pnt, ':');
pnt = cvt_integer (pnt + 1, &i); pnt = cvt_integer (pnt + 1, &i);
spnt = find_symbol (i); spnt = find_symbol (i);
if(spnt != (struct VMS_DBG_Symbol*) NULL) { if (spnt) {
while((spnt->advanced == POINTER) || (spnt->advanced == ARRAY)) while (spnt->advanced == POINTER || spnt->advanced == ARRAY)
{ {
i = spnt->type2; i = spnt->type2;
spnt1 = find_symbol (spnt->type2); spnt1 = find_symbol (spnt->type2);
@ -3041,13 +3043,13 @@ VMS_LSYM_Parse ()
tlen += strlen (str); tlen += strlen (str);
parse_buffer = (char *) xmalloc (tlen + 1); parse_buffer = (char *) xmalloc (tlen + 1);
strcpy (parse_buffer, S_GET_NAME (sp)); strcpy (parse_buffer, S_GET_NAME (sp));
pnt2 = parse_buffer + strlen(S_GET_NAME (sp)) - 1; pnt2 = parse_buffer + strlen(parse_buffer) - 1;
*pnt2 = '\0'; *pnt2 = '\0';
spnext = sp; spnext = sp;
do { do {
spnext = symbol_next (spnext); spnext = symbol_next (spnext);
str = S_GET_NAME (spnext); str = S_GET_NAME (spnext);
strcat (pnt2, S_GET_NAME (spnext)); strcat (pnt2, str);
pnt2 += strlen (str) - 1; pnt2 += strlen (str) - 1;
*str = '\0'; /* Erase this string */ *str = '\0'; /* Erase this string */
if (*pnt2 != '?') break; if (*pnt2 != '?') break;
@ -3556,15 +3558,11 @@ VMS_Case_Hack_Symbol (In, Out)
i = 8; i = 8;
while ((--i >= 0) && (*In)) while ((--i >= 0) && (*In))
switch (vms_name_mapping){ switch (vms_name_mapping){
case 0: *Out++ = islower(*In) ? case 0: *Out++ = islower (*In) ? toupper (*In++) : *In++;
toupper (*In++) :
*In++;
break; break;
case 3: *Out++ = *In++; case 3: *Out++ = *In++;
break; break;
case 2: *Out++ = isupper(*In) ? case 2: *Out++ = isupper (*In) ? tolower (*In++) : *In++;
tolower(*In++) :
*In++;
break; break;
} }
} }