Comments (1)
diff --git a/src/main/java/org/anarres/cpp/Preprocessor.java b/src/main/java/org/anarres/cpp/Preprocessor.java
index 18a0605..767fa32 100644
--- a/src/main/java/org/anarres/cpp/Preprocessor.java
+++ b/src/main/java/org/anarres/cpp/Preprocessor.java
@@ -782,16 +782,29 @@ public class Preprocessor implements Closeable {
/* space may still be true here, thus trailing space
* is stripped from arguments. */
+
if (args.size() != m.getArgs()) {
- error(tok,
- "macro " + m.getName()
- + " has " + m.getArgs() + " parameters "
- + "but given " + args.size() + " args");
- /* We could replay the arg tokens, but I
- * note that GNU cpp does exactly what we do,
- * i.e. output the macro name and chew the args.
- */
- return false;
+ if (m.isVariadic()) {
+ if (args.size() == m.getArgs() - 1)
+ args.add(new Argument ());
+ else {
+ error(tok,
+ "variadic macro " + m.getName()
+ + " has at least " + (m.getArgs() - 1) + " parameters "
+ + "but given " + args.size() + " args");
+ return false;
+ }
+ } else {
+ error(tok,
+ "macro " + m.getName()
+ + " has " + m.getArgs() + " parameters "
+ + "but given " + args.size() + " args");
+ /* We could replay the arg tokens, but I
+ * note that GNU cpp does exactly what we do,
+ * i.e. output the macro name and chew the args.
+ */
+ return false;
+ }
}
for (Argument a : args) {
from jcpp.
Related Issues (20)
- NullPointerException when #endif is missing HOT 2
- 0x is not a legal hex constant
- Handle framework includes properly HOT 3
- Absolute paths in includes HOT 11
- ``, ## VA_ARGS'' should remove the comma, if the variadic argument is empty. HOT 5
- Whitespace used in token pasting HOT 5
- pragma() should use source_token() not token()
- Re-check multiline comment whitespace preservation HOT 1
- Line number mismatch after pop_source() HOT 1
- Fix unit test suite on windows
- Any tutorials on this project? HOT 5
- Stripping line comments HOT 1
- Support extension of preprocessor HOT 1
- ClassCastException with character constants in expressions HOT 1
- Please publish module names HOT 2
- skip empty LN with # instead of filling LN HOT 1
- Unable to run Main class via Gradle
- Link to coverage report on README.md is broken
- Main doesn't return nonzero exit code on failure. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jcpp.