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