[rfc] Eliminate some __STDC__

Andrew Cagney ac131313@cygnus.com
Tue Mar 13 17:15:00 GMT 2001


Some fallout from ISO-C.

One thing should be noted.  I the patch strips a conditional ``inline''
prefix to a function.   I figure the compiler will be smart enough to
know when this should be done.

	Andrew
2001-03-13  Andrew Cagney  <ac131313@redhat.com>

	* ui-out.h: Remove #if __STDC__, assume an ISO-C compiler.
	* m3-nat.c: Ditto.
	* p-lang.h: Ditto.
	* printcmd.c (printf_command): Ditto.
	* ch-exp.c (match_integer_literal): Ditto.
	* scm-tags.h: Ditto.
	* ser-go32.c: Ditto.
	* hppa-tdep.c (unwind_command): Ditto.
	* eval.c (evaluate_subexp): Delete ``inline'' attribute.
	* defs.h (volatile): Delete macro definition.  Assume __STDC__.
	* remote-adapt.c (volatile): Ditto.
	* remote-eb.c (volatile): Ditto.
	* remote-mm.c (volatile): Ditto.
	* defs.h (alloca): Assume __STDC__, declare returning void *.

Index: ch-exp.c
===================================================================
RCS file: /cvs/src/src/gdb/ch-exp.c,v
retrieving revision 1.7
diff -p -r1.7 ch-exp.c
*** ch-exp.c	2001/03/06 08:21:06	1.7
--- ch-exp.c	2001/03/14 01:10:03
*************** match_integer_literal (void)
*** 1788,1794 ****
    else
      {
        yylval.typed_val.val = ival;
! #if defined(CC_HAS_LONG_LONG) && defined(__STDC__)
        if (ival > (LONGEST) 2147483647U || ival < -(LONGEST) 2147483648U)
  	yylval.typed_val.type = builtin_type_long_long;
        else
--- 1788,1794 ----
    else
      {
        yylval.typed_val.val = ival;
! #if defined(CC_HAS_LONG_LONG)
        if (ival > (LONGEST) 2147483647U || ival < -(LONGEST) 2147483648U)
  	yylval.typed_val.type = builtin_type_long_long;
        else
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.42
diff -p -r1.42 defs.h
*** defs.h	2001/03/07 16:09:03	1.42
--- defs.h	2001/03/14 01:10:03
*************** enum val_prettyprint
*** 764,786 ****
  #define CONST_PTR const
  #endif
  
- /*
-  * Allow things in gdb to be declared "volatile".  If compiling ANSI, it
-  * just works.  If compiling with gcc but non-ansi, redefine to __volatile__.
-  * If non-ansi, non-gcc, then eliminate "volatile" entirely, making those
-  * objects be read-write rather than read-only.
-  */
- 
- #ifndef volatile
- #ifndef __STDC__
- #ifdef __GNUC__
- #define volatile __volatile__
- #else
- #define volatile		/* nothing */
- #endif /* GNUC */
- #endif /* STDC */
- #endif /* volatile */
- 
  /* Defaults for system-wide constants (if not defined by xm.h, we fake it).
     FIXME: Assumes 2's complement arithmetic */
  
--- 764,769 ----
*************** extern void free ();
*** 993,1003 ****
  /* We need to be careful not to declare this in a way which conflicts with
     bison.  Bison never declares it as char *, but under various circumstances
     (like __hpux) we need to use void *.  */
- #if defined (__STDC__) || defined (__hpux)
  extern void *alloca ();
- #else /* Don't use void *.  */
- extern char *alloca ();
- #endif /* Don't use void *.  */
  #endif /* Not _AIX */
  #endif /* Not HAVE_ALLOCA_H */
  #endif /* Not GNU C */
--- 976,982 ----
Index: eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.11
diff -p -r1.11 eval.c
*** eval.c	2001/03/07 02:57:08	1.11
--- eval.c	2001/03/14 01:10:04
*************** static LONGEST
*** 61,69 ****
  init_array_element (value_ptr, value_ptr, struct expression *,
  		    int *, enum noside, LONGEST, LONGEST);
  
- #if defined (__GNUC__) && !__STDC__
- inline
- #endif
  static value_ptr
  evaluate_subexp (struct type *expect_type, register struct expression *exp,
  		 register int *pos, enum noside noside)
--- 61,66 ----
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.10
diff -p -r1.10 hppa-tdep.c
*** hppa-tdep.c	2001/03/06 08:21:08	1.10
--- hppa-tdep.c	2001/03/14 01:10:06
*************** unwind_command (char *exp, int from_tty)
*** 4524,4534 ****
    printf_unfiltered ("\n\tregion_end = ");
    print_address (u->region_end, gdb_stdout);
  
- #ifdef __STDC__
  #define pif(FLD) if (u->FLD) printf_unfiltered (" "#FLD);
- #else
- #define pif(FLD) if (u->FLD) printf_unfiltered (" FLD");
- #endif
  
    printf_unfiltered ("\n\tflags =");
    pif (Cannot_unwind);
--- 4524,4530 ----
*************** unwind_command (char *exp, int from_tty)
*** 4553,4563 ****
  
    putchar_unfiltered ('\n');
  
- #ifdef __STDC__
  #define pin(FLD) printf_unfiltered ("\t"#FLD" = 0x%x\n", u->FLD);
- #else
- #define pin(FLD) printf_unfiltered ("\tFLD = 0x%x\n", u->FLD);
- #endif
  
    pin (Region_description);
    pin (Entry_FR);
--- 4549,4555 ----
Index: m3-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/m3-nat.c,v
retrieving revision 1.10
diff -p -r1.10 m3-nat.c
*** m3-nat.c	2001/03/06 08:21:09	1.10
--- m3-nat.c	2001/03/14 01:10:09
*************** mach3_read_inferior (CORE_ADDR addr, cha
*** 1832,1844 ****
    return length;
  }
  
- #ifdef __STDC__
  #define CHK_GOTO_OUT(str,ret) \
    do if (ret != KERN_SUCCESS) { errstr = #str; goto out; } while(0)
- #else
- #define CHK_GOTO_OUT(str,ret) \
-   do if (ret != KERN_SUCCESS) { errstr = str; goto out; } while(0)
- #endif
  
  struct vm_region_list
  {
--- 1832,1839 ----
*************** m3_open (char *arg, int from_tty)
*** 4225,4235 ****
  }
  
  #ifdef DUMP_SYSCALL
- #ifdef __STDC__
  #define STR(x) #x
- #else
- #define STR(x) "x"
- #endif
  
  char *bsd1_names[] =
  {
--- 4220,4226 ----
Index: p-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/p-lang.h,v
retrieving revision 1.1
diff -p -r1.1 p-lang.h
*** p-lang.h	2000/06/14 12:27:59	1.1
--- p-lang.h	2001/03/14 01:10:10
***************
*** 19,27 ****
  
  /* This file is derived from c-lang.h */
  
- #ifdef __STDC__			/* Forward decls for prototypes */
  struct value;
- #endif
  
  extern int pascal_parse (void);	/* Defined in p-exp.y */
  
--- 19,25 ----
Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.17
diff -p -r1.17 printcmd.c
*** printcmd.c	2001/03/06 08:21:11	1.17
--- printcmd.c	2001/03/14 01:10:12
*************** printf_command (char *arg, int from_tty)
*** 2077,2087 ****
  	      *f++ = '\\';
  	      break;
  	    case 'a':
- #ifdef __STDC__
  	      *f++ = '\a';
- #else
- 	      *f++ = '\007';	/* Bell */
- #endif
  	      break;
  	    case 'b':
  	      *f++ = '\b';
--- 2077,2083 ----
Index: remote-adapt.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-adapt.c,v
retrieving revision 1.10
diff -p -r1.10 remote-adapt.c
*** remote-adapt.c	2001/03/06 08:21:11	1.10
--- remote-adapt.c	2001/03/14 01:10:12
*************** get_hex_regs (int n, int regno)
*** 309,320 ****
  /* Called when SIGALRM signal sent due to alarm() timeout.  */
  #ifndef HAVE_TERMIO
  
- #ifndef __STDC__
- #ifndef volatile
- #define volatile
- /**/
- # endif
- #endif
  volatile int n_alarms;
  
  void
--- 309,314 ----
Index: remote-eb.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-eb.c,v
retrieving revision 1.10
diff -p -r1.10 remote-eb.c
*** remote-eb.c	2001/03/06 08:21:12	1.10
--- remote-eb.c	2001/03/14 01:10:12
*************** get_hex_regs (int n, int regno)
*** 202,211 ****
  /* Called when SIGALRM signal sent due to alarm() timeout.  */
  #ifndef HAVE_TERMIO
  
- #ifndef __STDC__
- #define volatile
- /**/
- #endif
  volatile int n_alarms;
  
  void
--- 202,207 ----
Index: remote-mm.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-mm.c,v
retrieving revision 1.9
diff -p -r1.9 remote-mm.c
*** remote-mm.c	2001/03/06 08:21:12	1.9
--- remote-mm.c	2001/03/14 01:10:27
*************** FILE *mm_stream;
*** 118,129 ****
  /* Called when SIGALRM signal sent due to alarm() timeout.  */
  #ifndef HAVE_TERMIO
  
- #ifndef __STDC__
- #ifndef volatile
- #define volatile
- /**/
- # endif
- #endif
  volatile int n_alarms;
  
  static void
--- 118,123 ----
Index: scm-tags.h
===================================================================
RCS file: /cvs/src/src/gdb/scm-tags.h,v
retrieving revision 1.2
diff -p -r1.2 scm-tags.h
*** scm-tags.h	2001/03/06 08:21:16	1.2
--- scm-tags.h	2001/03/14 01:10:27
*************** extern int scm_tc16_key_vector;
*** 375,385 ****
  
  #endif /* 0 */
  
- #ifdef __STDC__
- 
- #else /* STDC */
- 
- #endif /* STDC */
- 
  
  #endif /* TAGSH */
--- 375,379 ----
Index: ser-go32.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-go32.c,v
retrieving revision 1.8
diff -p -r1.8 ser-go32.c
*** ser-go32.c	2001/02/04 07:48:18	1.8
--- ser-go32.c	2001/03/14 01:10:27
*************** dos_comisr (int irq)
*** 355,365 ****
      }
  }
  
- #ifdef __STDC__
  #define ISRNAME(x) dos_comisr##x
- #else
- #define ISRNAME(x) dos_comisr/**/x
- #endif
  #define ISR(x) static void ISRNAME(x)() {dos_comisr(x);}
  
  ISR (0) ISR (1) ISR (2) ISR (3)
--- 355,361 ----
Index: ui-out.h
===================================================================
RCS file: /cvs/src/src/gdb/ui-out.h,v
retrieving revision 1.4
diff -p -r1.4 ui-out.h
*** ui-out.h	2001/03/06 08:21:17	1.4
--- ui-out.h	2001/03/14 01:10:28
***************
*** 25,34 ****
  
  /* The ui_out structure */
  
- #if __STDC__
  struct ui_out;
  struct ui_out_data;
- #endif
  
  
  /* the current ui_out */
--- 25,32 ----


More information about the Gdb-patches mailing list