aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/dmd/lexer.d
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-06-26 09:57:21 -0700
committerIan Lance Taylor <iant@golang.org>2023-06-26 09:57:21 -0700
commitaa1e672b5d99102b03eb5fb9c51609c45f62bff7 (patch)
tree886212591b1c9d127eaaf234a4a2e22452ea384a /gcc/d/dmd/lexer.d
parent97e31a0a2a2d2273687fcdb4e5416aab1a2186e1 (diff)
parent3a39a31b8ae9c6465434aefa657f7fcc86f905c0 (diff)
downloadgcc-devel/gccgo.zip
gcc-devel/gccgo.tar.gz
gcc-devel/gccgo.tar.bz2
Merge from trunk revision 3a39a31b8ae9c6465434aefa657f7fcc86f905c0.devel/gccgo
Diffstat (limited to 'gcc/d/dmd/lexer.d')
-rw-r--r--gcc/d/dmd/lexer.d26
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/d/dmd/lexer.d b/gcc/d/dmd/lexer.d
index c9ed35f..f0f7872 100644
--- a/gcc/d/dmd/lexer.d
+++ b/gcc/d/dmd/lexer.d
@@ -2664,14 +2664,19 @@ class Lexer
eSink.error(loc, format, args);
}
- final void deprecation(const(char)* format)
+ void deprecation(T...)(const ref Loc loc, const(char)* format, T args)
{
- eSink.deprecation(token.loc, format);
+ eSink.deprecation(loc, format, args);
}
- final void deprecationSupplemental(const(char)* format)
+ void deprecation(T...)(const(char)* format, T args)
{
- eSink.deprecationSupplemental(token.loc, format);
+ eSink.deprecation(token.loc, format, args);
+ }
+
+ void deprecationSupplemental(T...)(const(char)* format, T args)
+ {
+ eSink.deprecationSupplemental(token.loc, format, args);
}
/***************************************
@@ -2695,12 +2700,21 @@ class Lexer
else
{
const locx = loc();
- eSink.warning(locx, "C preprocessor directive `#%s` is not supported", n.ident.toChars());
+ // @@@DEPRECATED_2.103@@@
+ // Turn into an error in 2.113
+ if (inTokenStringConstant)
+ deprecation(locx, "token string requires valid D tokens, not `#%s`", n.ident.toChars());
+ else
+ error(locx, "C preprocessor directive `#%s` is not supported", n.ident.toChars());
}
}
else if (n.value == TOK.if_)
{
- error("C preprocessor directive `#if` is not supported, use `version` or `static if`");
+ const locx = loc();
+ if (inTokenStringConstant)
+ error(locx, "token string requires valid D tokens, not `#if`");
+ else
+ error(locx, "C preprocessor directive `#if` is not supported, use `version` or `static if`");
}
return false;
}