Commit 7e2e8179 by Zack Weinberg Committed by Zack Weinberg

re PR c++/13596 (value of __cplusplus)

	PR 13596
	* dbxout.c (dbx_output_lbrac, dbx_output_rbrac): New
	functions, broken out of dbxout_block.
	(dbxout_block): The block at depth 0 should get LBRAC/RBRAC
	stabs too, if it contains symbols.  Use the begin_label and
	the Lscope label (emitted by dbxout_function_end) for the
	range of this block.

From-SVN: r85544
parent 73a8adb6
2004-08-03 Zack Weinberg <zack@codesourcery.com>
PR 13596
* dbxout.c (dbx_output_lbrac, dbx_output_rbrac): New
functions, broken out of dbxout_block.
(dbxout_block): The block at depth 0 should get LBRAC/RBRAC
stabs too, if it contains symbols. Use the begin_label and
the Lscope label (emitted by dbxout_function_end) for the
range of this block.
2004-08-03 Nathanael Nerode <neroden@gcc.gnu.org> 2004-08-03 Nathanael Nerode <neroden@gcc.gnu.org>
* doc/install.texi: Update autoconf version requirements. * doc/install.texi: Update autoconf version requirements.
......
...@@ -3089,6 +3089,46 @@ dbxout_args (tree args) ...@@ -3089,6 +3089,46 @@ dbxout_args (tree args)
} }
} }
/* Subroutine of dbxout_block. Emit an N_LBRAC stab referencing LABEL.
BEGIN_LABEL is the name of the beginning of the function, which may
be required. */
static void
dbx_output_lbrac (const char *label,
const char *begin_label ATTRIBUTE_UNUSED)
{
#ifdef DBX_OUTPUT_LBRAC
DBX_OUTPUT_LBRAC (asmfile, label);
#else
fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_LBRAC);
assemble_name (asmfile, label);
#if DBX_BLOCKS_FUNCTION_RELATIVE
putc ('-', asmfile);
assemble_name (asmfile, begin_label);
#endif
fprintf (asmfile, "\n");
#endif
}
/* Subroutine of dbxout_block. Emit an N_RBRAC stab referencing LABEL.
BEGIN_LABEL is the name of the beginning of the function, which may
be required. */
static void
dbx_output_rbrac (const char *label,
const char *begin_label ATTRIBUTE_UNUSED)
{
#ifdef DBX_OUTPUT_RBRAC
DBX_OUTPUT_RBRAC (asmfile, label);
#else
fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_RBRAC);
assemble_name (asmfile, label);
#if DBX_BLOCKS_FUNCTION_RELATIVE
putc ('-', asmfile);
assemble_name (asmfile, begin_label);
#endif
fprintf (asmfile, "\n");
#endif
}
/* Output everything about a symbol block (a BLOCK node /* Output everything about a symbol block (a BLOCK node
that represents a scope level), that represents a scope level),
including recursive output of contained blocks. including recursive output of contained blocks.
...@@ -3109,15 +3149,11 @@ dbxout_args (tree args) ...@@ -3109,15 +3149,11 @@ dbxout_args (tree args)
static void static void
dbxout_block (tree block, int depth, tree args) dbxout_block (tree block, int depth, tree args)
{ {
int blocknum = -1;
#if DBX_BLOCKS_FUNCTION_RELATIVE
const char *begin_label; const char *begin_label;
if (current_function_func_begin_label != NULL_TREE) if (current_function_func_begin_label != NULL_TREE)
begin_label = IDENTIFIER_POINTER (current_function_func_begin_label); begin_label = IDENTIFIER_POINTER (current_function_func_begin_label);
else else
begin_label = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); begin_label = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
#endif
while (block) while (block)
{ {
...@@ -3125,6 +3161,7 @@ dbxout_block (tree block, int depth, tree args) ...@@ -3125,6 +3161,7 @@ dbxout_block (tree block, int depth, tree args)
if (TREE_USED (block) && TREE_ASM_WRITTEN (block)) if (TREE_USED (block) && TREE_ASM_WRITTEN (block))
{ {
int did_output; int did_output;
int blocknum = BLOCK_NUMBER (block);
/* In dbx format, the syms of a block come before the N_LBRAC. /* In dbx format, the syms of a block come before the N_LBRAC.
If nothing is output, we don't need the N_LBRAC, either. */ If nothing is output, we don't need the N_LBRAC, either. */
...@@ -3138,11 +3175,20 @@ dbxout_block (tree block, int depth, tree args) ...@@ -3138,11 +3175,20 @@ dbxout_block (tree block, int depth, tree args)
the block. Use the block's tree-walk order to generate the block. Use the block's tree-walk order to generate
the assembler symbols LBBn and LBEn the assembler symbols LBBn and LBEn
that final will define around the code in this block. */ that final will define around the code in this block. */
if (depth > 0 && did_output) if (did_output)
{ {
char buf[20]; char buf[20];
blocknum = BLOCK_NUMBER (block); const char *scope_start;
ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum);
if (depth == 0)
/* The outermost block doesn't get LBB labels; use
the function symbol. */
scope_start = begin_label;
else
{
ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum);
scope_start = buf;
}
if (BLOCK_HANDLER_BLOCK (block)) if (BLOCK_HANDLER_BLOCK (block))
{ {
...@@ -3152,44 +3198,30 @@ dbxout_block (tree block, int depth, tree args) ...@@ -3152,44 +3198,30 @@ dbxout_block (tree block, int depth, tree args)
{ {
fprintf (asmfile, "%s\"%s:C1\",%d,0,0,", ASM_STABS_OP, fprintf (asmfile, "%s\"%s:C1\",%d,0,0,", ASM_STABS_OP,
IDENTIFIER_POINTER (DECL_NAME (decl)), N_CATCH); IDENTIFIER_POINTER (DECL_NAME (decl)), N_CATCH);
assemble_name (asmfile, buf); assemble_name (asmfile, scope_start);
fprintf (asmfile, "\n"); fprintf (asmfile, "\n");
decl = TREE_CHAIN (decl); decl = TREE_CHAIN (decl);
} }
} }
dbx_output_lbrac (scope_start, begin_label);
#ifdef DBX_OUTPUT_LBRAC
DBX_OUTPUT_LBRAC (asmfile, buf);
#else
fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_LBRAC);
assemble_name (asmfile, buf);
#if DBX_BLOCKS_FUNCTION_RELATIVE
putc ('-', asmfile);
assemble_name (asmfile, begin_label);
#endif
fprintf (asmfile, "\n");
#endif
} }
/* Output the subblocks. */ /* Output the subblocks. */
dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE); dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE);
/* Refer to the marker for the end of the block. */ /* Refer to the marker for the end of the block. */
if (depth > 0 && did_output) if (did_output)
{ {
char buf[20]; char buf[100];
ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum); if (depth == 0)
#ifdef DBX_OUTPUT_RBRAC /* The outermost block doesn't get LBE labels;
DBX_OUTPUT_RBRAC (asmfile, buf); use the "scope" label which will be emitted
#else by dbxout_function_end. */
fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_RBRAC); ASM_GENERATE_INTERNAL_LABEL (buf, "Lscope", scope_labelno);
assemble_name (asmfile, buf); else
#if DBX_BLOCKS_FUNCTION_RELATIVE ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum);
putc ('-', asmfile);
assemble_name (asmfile, begin_label); dbx_output_rbrac (buf, begin_label);
#endif
fprintf (asmfile, "\n");
#endif
} }
} }
block = BLOCK_CHAIN (block); block = BLOCK_CHAIN (block);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment