[2/N] Do not hide asm_out_file in ASM_OUTPUT_ASCII.
Commit Message
Again a preparation patch that was tested on all cross compilers.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed?
Thanks,
Martin
Comments
On Thu, Sep 16, 2021 at 12:01 PM Martin Liška <mliska@suse.cz> wrote:
>
> Again a preparation patch that was tested on all cross compilers.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
I think you want to retain
- FILE *_hide_asm_out_file = (MYFILE);
and use _hide_asm_out_file to preserve MYFILE execution counts in case
it contains side-effects.
OK with that change.
Richard.
> Thanks,
> Martin
On 9/22/21 11:44, Richard Biener wrote:
> On Thu, Sep 16, 2021 at 12:01 PM Martin Liška <mliska@suse.cz> wrote:
>>
>> Again a preparation patch that was tested on all cross compilers.
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> Ready to be installed?
>
> I think you want to retain
>
> - FILE *_hide_asm_out_file = (MYFILE);
Oh, oh!
>
> and use _hide_asm_out_file to preserve MYFILE execution counts in case
> it contains side-effects.
I do always forget about the fact that macros can have side-effects.
Thanks for review,
Martin
>
> OK with that change.
>
> Richard.
>
>> Thanks,
>> Martin
From 0e5095274bb4e16ad28a5a52f30bd3887df25fde Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Wed, 15 Sep 2021 13:52:35 +0200
Subject: [PATCH 2/3] Do not hide asm_out_file in ASM_OUTPUT_ASCII.
gcc/ChangeLog:
* defaults.h (ASM_OUTPUT_ASCII): Do not hide global variable
asm_out_file and stream directly to MYFILE.
---
gcc/defaults.h | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
@@ -61,36 +61,34 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifndef ASM_OUTPUT_ASCII
#define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
do { \
- FILE *_hide_asm_out_file = (MYFILE); \
const unsigned char *_hide_p = (const unsigned char *) (MYSTRING); \
int _hide_thissize = (MYLENGTH); \
{ \
- FILE *asm_out_file = _hide_asm_out_file; \
const unsigned char *p = _hide_p; \
int thissize = _hide_thissize; \
int i; \
- fprintf (asm_out_file, "\t.ascii \""); \
+ fprintf (MYFILE, "\t.ascii \""); \
\
for (i = 0; i < thissize; i++) \
{ \
int c = p[i]; \
if (c == '\"' || c == '\\') \
- putc ('\\', asm_out_file); \
+ putc ('\\', MYFILE); \
if (ISPRINT (c)) \
- putc (c, asm_out_file); \
+ putc (c, MYFILE); \
else \
{ \
- fprintf (asm_out_file, "\\%o", c); \
+ fprintf (MYFILE, "\\%o", c); \
/* After an octal-escape, if a digit follows, \
terminate one string constant and start another. \
The VAX assembler fails to stop reading the escape \
after three digits, so this is the only way we \
can get it to parse the data properly. */ \
if (i < thissize - 1 && ISDIGIT (p[i + 1])) \
- fprintf (asm_out_file, "\"\n\t.ascii \""); \
+ fprintf (MYFILE, "\"\n\t.ascii \""); \
} \
} \
- fprintf (asm_out_file, "\"\n"); \
+ fprintf (MYFILE, "\"\n"); \
} \
} \
while (0)
--
2.33.0