Thanks for the patch!


On 2012-09-13 08:46 , Richard Guenther wrote:

Index: gcc/testsuite/g++.dg/ext/builtin-location.C
===================================================================
*** /dev/null   1970-01-01 00:00:00.000000000 +0000
--- gcc/testsuite/g++.dg/ext/builtin-location.C 2012-09-13 14:27:34.868103539 
+0200
***************
*** 0 ****
--- 1,20 ----
+ // { dg-do link }
+
+ #include <cstdio>
+
+ void bar (const char *file = __builtin_FILE (),
+         const char *function = __builtin_FUNCTION (),
+         int line = __builtin_LINE ())
+ {
+   printf ("%s (%s): %d\n", file, function, line);

Shouldn't this test that it is getting the file, function and line for the call to bar() inside of main?

Maybe something like:

const char *FILE;
const char *FN;
int LINE;

void bar (const char *file = __builtin_FILE (),
        const char *function = __builtin_FUNCTION (),
        int line = __builtin_LINE ())
{
  FILE = file;
  FN = function;
  LINE = line;
}

int main()
{
  bar();
  if (LINE != __LINE__ - 1)
    return 1;
  if (strcmp (function, "main") != 0)
    return 1;
  if (strcmp (file, "builtin-location.C") != 0)
    return 1;
  return 0;
}



Diego.

Reply via email to