This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Factor out uses of TYPE_ASM_OP and SIZE_ASM_OP
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: zack at codesourcery dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 22 Jul 2002 18:31:13 -0400 (EDT)
- Subject: Re: RFC: Factor out uses of TYPE_ASM_OP and SIZE_ASM_OP
> From: Zack Weinberg <zack at codesourcery dot com>
>
> I'm testing the patch right now: I intend to do an x86-linux bootstrap
> and build cross compilers to each affected target. However, I would
> appreciate comments at this stage, too.
>
> zw
>
> /* Output the size directive for a decl in rest_of_decl_compilation
> @@ -259,15 +246,15 @@ Boston, MA 02111-1307, USA. */
> #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
> do { \
> const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
> + HOST_WIDE_INT size; \
> if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
> && ! AT_END && TOP_LEVEL \
> && DECL_INITIAL (DECL) == error_mark_node \
> && !size_directive_output) \
> { \
> size_directive_output = 1; \
> - fprintf (FILE, "%s", SIZE_ASM_OP); \
> - assemble_name (FILE, name); \
> - fprintf (FILE, " , %d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
> + size = int_size_in_bytes (TREE_TYPE (DECL)); \
> + ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
> } \
> } while (0)
> #endif
When possible, please consider constifying all variables in the macros
you touch. E.g. in the above, `name' (and `size' if the decl is moved
into the inner scope) can be constified.
IMHO, explicitly marking something const is more clear than scanning
the code with your eye. Plus it might help optimize some situations.
Thanks,
--Kaveh
--
Kaveh R. Ghazi Director of Systems Architecture
ghazi@caip.rutgers.edu Qwest Solutions