# New Ticket Created by  Matt Kraai 
# Please include the string:  [perl #52028]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=52028 >


Howdy,

If a macro invocation that uses CONST_STRING is split into multiple
lines, icc uses the wrong line number for the CONST_STRING macro.  The
attached patch puts such invocations on a single line and updates the
documentation.

-- 
Matt
>From 27be6d429f7fb8c737e3bb3e001103ea6bd08f67 Mon Sep 17 00:00:00 2001
From: Matt Kraai <[EMAIL PROTECTED]>
Date: Sat, 22 Mar 2008 19:20:38 -0700
Subject: [PATCH] If CONST_STRING is used in a macro invocation, do not split the
 invocation across more than one line

---
 src/dynext.c                |   12 ++++++------
 src/pmc/capture.pmc         |    8 ++++----
 src/pmc/unmanagedstruct.pmc |    3 +--
 tools/build/c2str.pl        |    9 +++++----
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/dynext.c b/src/dynext.c
index f559353..9892558 100644
--- a/src/dynext.c
+++ b/src/dynext.c
@@ -459,13 +459,13 @@ PARROT_CANNOT_RETURN_NULL
 PMC *
 Parrot_clone_lib_into(ARGMOD(Interp *d), ARGMOD(Interp *s), ARGIN(PMC *lib_pmc))
 {
-    STRING * const wo_ext = clone_string_into(d, s, VTABLE_getprop(s, lib_pmc,
-        CONST_STRING(s, "_filename")));
-    STRING * const lib_name = clone_string_into(d, s, VTABLE_getprop(s, lib_pmc,
-        CONST_STRING(s, "_lib_name")));
+    STRING * const wo_ext = clone_string_into(d, s,
+        VTABLE_getprop(s, lib_pmc, CONST_STRING(s, "_filename")));
+    STRING * const lib_name = clone_string_into(d, s,
+        VTABLE_getprop(s, lib_pmc, CONST_STRING(s, "_lib_name")));
     void * const handle = PMC_data(lib_pmc);
-    STRING * const type = VTABLE_get_string(s,
-        VTABLE_getprop(s, lib_pmc, CONST_STRING(s, "_type")));
+    STRING * const type =
+        VTABLE_get_string(s, VTABLE_getprop(s, lib_pmc, CONST_STRING(s, "_type")));
 
     if (!string_equal(s, type, CONST_STRING(s, "Ops"))) {
         /* we can't clone oplibs in the normal way, since they're actually
diff --git a/src/pmc/capture.pmc b/src/pmc/capture.pmc
index 42eb47c..27e200c 100644
--- a/src/pmc/capture.pmc
+++ b/src/pmc/capture.pmc
@@ -451,8 +451,8 @@ Delete the element corresponding to C<key> in the hash component.
         if (PObj_is_object_TEST(SELF)) {
             STRING *classname = CONST_STRING(INTERP, "Capture");
             PMC    *classobj  = Parrot_oo_get_class_str(INTERP, classname);
-            capt              = VTABLE_get_attr_keyed(interp, SELF, classobj,
-                                    CONST_STRING(interp, "proxy"));
+            STRING *attribute = CONST_STRING(interp, "proxy");
+            capt              = VTABLE_get_attr_keyed(interp, SELF, classobj, attribute);
         }
 
         CAPTURE_array_CREATE(INTERP, capt);
@@ -469,8 +469,8 @@ Delete the element corresponding to C<key> in the hash component.
         if (PObj_is_object_TEST(SELF)) {
             STRING *classname = CONST_STRING(INTERP, "Capture");
             PMC    *classobj  = Parrot_oo_get_class_str(INTERP, classname);
-            capt              = VTABLE_get_attr_keyed(interp, SELF, classobj,
-                                    CONST_STRING(interp, "proxy"));
+            STRING *attribute = CONST_STRING(interp, "proxy");
+            capt              = VTABLE_get_attr_keyed(interp, SELF, classobj, attribute);
         }
         CAPTURE_hash_CREATE(INTERP, capt);
         capt_hash = PARROT_CAPTURE(capt)->hash;
diff --git a/src/pmc/unmanagedstruct.pmc b/src/pmc/unmanagedstruct.pmc
index 0de5ae7..9d21aa7 100644
--- a/src/pmc/unmanagedstruct.pmc
+++ b/src/pmc/unmanagedstruct.pmc
@@ -389,8 +389,7 @@ ret_pmc(PARROT_INTERP, PMC *pmc, char *p, int type, INTVAL idx)
 
             /* grab the struct from the metadata */
             if (ptr->pmc_ext && PMC_metadata(ptr)) {
-                ret = VTABLE_getprop(interp, ptr,
-                        CONST_STRING(interp, "_struct"));
+                ret = VTABLE_getprop(interp, ptr, CONST_STRING(interp, "_struct"));
             }
             else {
                 real_exception(interp, NULL, E_TypeError,
diff --git a/tools/build/c2str.pl b/tools/build/c2str.pl
index cc2138b..b6cfcbb 100644
--- a/tools/build/c2str.pl
+++ b/tools/build/c2str.pl
@@ -113,10 +113,11 @@ HEADER
     print $ALL "# $infile\n";
     my %this_file_seen;
 
-    # NOTE: when CONST_STRING gets used in a .pmc it *should not* be split
-    # across more than one line, because some compilers generate line
-    # numbers in such cases differently to the way gcc does this (a case in
-    # point is Intel's C compiler, icc) and hence the #defined CONST_STRING
+    # NOTE: when CONST_STRING gets used it and any macro invocations
+    # that it is used in *should not* be split across more than one
+    # line, because some compilers generate line numbers in such cases
+    # differently from the way gcc does this (a case in point is
+    # Intel's C compiler, icc) and hence the #defined CONST_STRING
     # won't be found by the compiler.
 
     # There is a chance that the same __LINE__ will reoccur if #line directives
-- 
1.5.4.4

Reply via email to