This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch to cp/decl.c
Mark Mitchell wrote:
I'd rather you just check input_filename. In future, there could
conceivably be artificial declarations for which we want to do the
conditionalized stuff. OK with that change.
Ok. I checked the attached patch into mainline.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
2005-04-22 Per Bothner <per@bothner.com>
* decl.c (make_rtl_for_nonlocal_decl): Don't try get_fileinfo if
input_filename is NULL, as it is for (say) __PRETTY_FUNCTION__.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1387
diff -u -p -r1.1387 decl.c
--- decl.c 21 Apr 2005 09:17:57 -0000 1.1387
+++ decl.c 22 Apr 2005 18:53:44 -0000
@@ -4543,6 +4543,7 @@ make_rtl_for_nonlocal_decl (tree decl, t
{
int toplev = toplevel_bindings_p ();
int defer_p;
+ const char *filename;
/* Set the DECL_ASSEMBLER_NAME for the object. */
if (asmspec)
@@ -4592,17 +4593,19 @@ make_rtl_for_nonlocal_decl (tree decl, t
/* We try to defer namespace-scope static constants so that they are
not emitted into the object file unnecessarily. */
+ filename = input_filename;
if (!DECL_VIRTUAL_P (decl)
&& TREE_READONLY (decl)
&& DECL_INITIAL (decl) != NULL_TREE
&& DECL_INITIAL (decl) != error_mark_node
+ && filename != NULL
&& ! EMPTY_CONSTRUCTOR_P (DECL_INITIAL (decl))
&& toplev
&& !TREE_PUBLIC (decl))
{
/* Fool with the linkage of static consts according to #pragma
interface. */
- struct c_fileinfo *finfo = get_fileinfo (lbasename (input_filename));
+ struct c_fileinfo *finfo = get_fileinfo (lbasename (filename));
if (!finfo->interface_unknown && !TREE_PUBLIC (decl))
{
TREE_PUBLIC (decl) = 1;