This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
libgcc2 warnings cleanup, i386
- To: gcc-patches at gcc dot gnu dot org
- Subject: libgcc2 warnings cleanup, i386
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Sun, 30 Jan 2000 23:39:17 -0800
This gets rid of the ANSI string concatenation in libgcc2 on x86.
Other platforms may need to tweak the MACHINE_STATE_SAVE/RESTORE
macros similarly.
zw
* libgcc2.c (BBINBUFSIZESTR): Kill.
(__bb_init_prg): Use fgets not fscanf.
(__bb_exit_trace_func): Don't use string constant
concatenation.
* i386.h (MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE): Don't
use string constant concatenation.
===================================================================
Index: libgcc2.c
--- libgcc2.c 2000/01/26 22:27:28 1.84
+++ libgcc2.c 2000/01/31 07:36:26
@@ -1907,11 +1907,6 @@ __bb_fork_func (void)
#define BBINBUFSIZE 500
-/* BBINBUFSIZE-1 with double quotes. We could use #BBINBUFSIZE or
- "BBINBUFSIZE" but want to avoid trouble with preprocessors. */
-
-#define BBINBUFSIZESTR "499"
-
struct bb_edge
{
struct bb_edge *next;
@@ -2189,8 +2184,8 @@ found: ;
struct bb_edge *bucket = bb_hashbuckets[i];
for ( ; bucket; bucket = bucket->next )
{
- fprintf (file, "Jump from block 0x%.*lx to "
- "block 0x%.*lx executed %*lu time(s)\n",
+ fprintf (file,
+ "Jump from block 0x%.*lx to block 0x%.*lx executed %*lu time(s)\n",
addr_len, bucket->src_addr,
addr_len, bucket->dst_addr,
cnt_len, bucket->count);
@@ -2261,8 +2256,12 @@ __bb_init_prg (void)
if (!(file = fopen ("bb.in", "r")))
return;
- while(fscanf (file, " %" BBINBUFSIZESTR "s ", buf) != EOF)
+ while(fgets (buf, BBINBUFSIZE, file) != 0)
{
+ i = strlen (buf);
+ if (buf[i] == '\n')
+ buf[i--] = '\0';
+
p = buf;
if (*p == '-')
{
===================================================================
Index: config/i386/i386.h
--- config/i386/i386.h 2000/01/25 05:59:17 1.96
+++ config/i386/i386.h 2000/01/31 07:36:26
@@ -1288,11 +1288,11 @@ typedef struct ix86_args {
Note that function `__bb_trace_ret' must not change the
machine state, especially the flag register. To grant
this, you must output code to save and restore registers
- either in this macro or in the macros MACHINE_STATE_SAVE_RET
- and MACHINE_STATE_RESTORE_RET. The last two macros will be
+ either in this macro or in the macros MACHINE_STATE_SAVE
+ and MACHINE_STATE_RESTORE. The last two macros will be
used in the function `__bb_trace_ret', so you must make
sure that the function prologue does not change any
- register prior to saving it with MACHINE_STATE_SAVE_RET.
+ register prior to saving it with MACHINE_STATE_SAVE.
else if profiling_block_flag != 0:
@@ -1332,11 +1332,11 @@ do { \
register int ecx_ __asm__("ecx"); \
register int edx_ __asm__("edx"); \
register int esi_ __asm__("esi"); \
- __asm__ __volatile__ ( \
- "push{l} %0\n\t" \
- "push{l} %1\n\t" \
- "push{l} %2\n\t" \
- "push{l} %3" \
+ __asm__ __volatile__ ("\
+push{l} %0\n\t\
+push{l} %1\n\t\
+push{l} %2\n\t\
+push{l} %3" \
: : "r"(eax_), "r"(ecx_), "r"(edx_), "r"(esi_)); \
} while (0);
@@ -1346,11 +1346,11 @@ do { \
register int ecx_ __asm__("ecx"); \
register int edx_ __asm__("edx"); \
register int esi_ __asm__("esi"); \
- __asm__ __volatile__ ( \
- "pop{l} %3\n\t" \
- "pop{l} %2\n\t" \
- "pop{l} %1\n\t" \
- "pop{l} %0" \
+ __asm__ __volatile__ ("\
+pop{l} %3\n\t\
+pop{l} %2\n\t\
+pop{l} %1\n\t\
+pop{l} %0" \
: "=r"(eax_), "=r"(ecx_), "=r"(edx_), "=r"(esi_)); \
} while (0);