aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-07-26 15:24:12 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2021-07-28 13:13:05 +0200
commit1a2306ffe79df89389cc850ce85c586d0f1c8264 (patch)
treec8d07586450afdd859cf8f8ae6c71eda45da2675 /gcc
parentb2f6e1de242fff5713763cd3146dcf3f9dee51ca (diff)
downloadgcc-1a2306ffe79df89389cc850ce85c586d0f1c8264.zip
gcc-1a2306ffe79df89389cc850ce85c586d0f1c8264.tar.gz
gcc-1a2306ffe79df89389cc850ce85c586d0f1c8264.tar.bz2
d: __FUNCTION__ doesn't work in core.stdc.stdio functions without cast (PR101441)
Backports fix from upstream to allow __FUNCTION__ and __PRETTY_FUNCTION__ to be used as C string literals. Reviewed-on: https://github.com/dlang/dmd/pull/12923 PR d/101441 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd f8c1ca928.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/d/dmd/MERGE2
-rw-r--r--gcc/d/dmd/expression.c4
-rw-r--r--gcc/testsuite/gdc.test/compilable/b19002.d12
3 files changed, 15 insertions, 3 deletions
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index 127f9f8..08bd50d 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-1d8386a63d412c9e77728b0b965025ac4dd40b75
+f8c1ca928360dd8c9f2fbb5771e2a5e398878ca0
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/gcc/d/dmd/expression.c b/gcc/d/dmd/expression.c
index 7166f97..18aa6aa 100644
--- a/gcc/d/dmd/expression.c
+++ b/gcc/d/dmd/expression.c
@@ -5620,7 +5620,7 @@ Expression *FuncInitExp::resolveLoc(Loc loc, Scope *sc)
s = "";
Expression *e = new StringExp(loc, const_cast<char *>(s));
e = expressionSemantic(e, sc);
- e = e->castTo(sc, type);
+ e->type = Type::tstring;
return e;
}
@@ -5654,7 +5654,7 @@ Expression *PrettyFuncInitExp::resolveLoc(Loc loc, Scope *sc)
Expression *e = new StringExp(loc, const_cast<char *>(s));
e = expressionSemantic(e, sc);
- e = e->castTo(sc, type);
+ e->type = Type::tstring;
return e;
}
diff --git a/gcc/testsuite/gdc.test/compilable/b19002.d b/gcc/testsuite/gdc.test/compilable/b19002.d
new file mode 100644
index 0000000..fd8e6d1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/b19002.d
@@ -0,0 +1,12 @@
+module b19002;
+
+void printf(scope const char* format){}
+
+void main()
+{
+ printf(__FILE__);
+ printf(__FILE_FULL_PATH__);
+ printf(__FUNCTION__);
+ printf(__PRETTY_FUNCTION__);
+ printf(__MODULE__);
+}