Comments (5)
Yep, this is probably a bug in the C grammar (maybe related to the preprocessor stuff).
Are you able to reduce the test case to the minimum?
from rust-code-analysis.
Yep, this is probably a bug in the C grammar (maybe related to the preprocessor stuff).
Are you able to reduce the test case to the minimum?
I made some revisions to the code by removing certain preprocessor parts and code lines. I'm not entirely certain if this was the correct approach, but I hope that it will be helpful.
static YYACTIONTYPE
yy_find_shift_action(YYCODETYPE iLookAhead, /* The look-ahead token */
YYACTIONTYPE stateno /* Current state number */
) {
do {
if (i >= YY_NLOOKAHEAD || yy_lookahead[i] != iLookAhead) {
#ifdef YYWILDCARD
{
if (
#if YY_SHIFT_MAX + YYWILDCARD >= YY_ACTTAB_COUNT
j < YY_ACTTAB_COUNT &&
#endif
j < (int)(sizeof(yy_lookahead) / sizeof(yy_lookahead[0])) &&
yy_lookahead[j] == YYWILDCARD && iLookAhead > 0) {
#ifndef NDEBUG
if (yyTraceFILE) {
fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", yyTracePrompt,
yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
}
#endif /* NDEBUG */
return yy_action[j];
}
}
#endif /* YYWILDCARD */
return yy_default[stateno];
}
} while (1);
}
from rust-code-analysis.
Are you sure this is the minimum amount of code to make it fail?
Could you try removing more and more until you get to something that doesn't fail? Then you can show us the snippet of code right before the last modification that makes it fail, and the snippet of code after that modification.
from rust-code-analysis.
Are you sure this is the minimum amount of code to make it fail? Could you try removing more and more until you get to something that doesn't fail? Then you can show us the snippet of code right before the last modification that makes it fail, and the snippet of code after that modification.
Hi, sorry for that. This time I made more eager modification through trial and error. I believe that the code has been reduced to the most minimal amount possible.
The code before last modification that makes it fail:
static YYACTIONTYPE yy_find_shift_action() {
do {
if (yy_lookahead[i] != iLookAhead) {
#ifdef YYWILDCARD
{
if (
#if YY_SHIFT_MAX + YYWILDCARD >= YY_ACTTAB_COUNT
j < YY_ACTTAB_COUNT &&
#endif
yy_lookahead[j] == YYWILDCARD) {
#ifndef NDEBUG
if (yyTraceFILE) {
fprintf(yyTraceFILE, "%sWILDCARD %s", yyTracePrompt,
yyTokenName[iLookAhead]);
}
#endif
}
}
#endif
}
} while (1);
}
Possible fix: Delete any inner #if...
pairs(additional code has been omitted for brevity).
...
#ifdef YYWILDCARD
{
if (
yy_lookahead[j] == YYWILDCARD) {
#ifndef NDEBUG
if (yyTraceFILE) {
fprintf(yyTraceFILE, "%sWILDCARD %s", yyTracePrompt,
yyTokenName[iLookAhead]);
}
#endif
}
}
#endif
...
Possible fix: Remove the brackets(i.e {}
)
...
if (yyTraceFILE)
fprintf(yyTraceFILE, "%sWILDCARD %s", yyTracePrompt,
yyTokenName[iLookAhead]);
...
Possible fix: Condense the function call into a single line
...
if (yyTraceFILE) {
fprintf(yyTraceFILE, "%sWILDCARD %s", yyTracePrompt, yyTokenName[iLookAhead]);
}
...
Possible fix: Change the condition of if statement.
...
#if YY_SHIFT_MAX + YYWILDCARD >= YY_ACTTAB_COUNT
j < YY_ACTTAB_COUNT
#endif
) {
...
from rust-code-analysis.
Thanks, that's better. I guess we could further reduce it by simplifying the statements (e.g. fprintf(yyTraceFILE, "%sWILDCARD %s", yyTracePrompt, yyTokenName[iLookAhead]);
could be a single statement like int x = 0;
or similar).
There is probably a but in the handling of macros.
from rust-code-analysis.
Related Issues (20)
- Add a LICENSE file HOT 2
- Are `Java` and `C#` metrics still pending? HOT 1
- Update docs mentioning that some metrics are supported for Java
- Implement metrics for Kotlin language
- Create a GitHub action which runs rust-code-analysis HOT 4
- empty function name for cpp
- Evaluate using Profile-Guided Optimization (PGO) and LLVM BOLT HOT 1
- Convert grammars checkers scripts and grammars updaters into `cargo-xtask` tasks
- Use git submodules instead of calling the git cli from the integration tests. HOT 1
- Make insta more verbose
- Make insta not stop at the first failure HOT 4
- Fix Windows insta tests HOT 1
- Add documentation on how to upgrade a grammar version to the Developers Guide HOT 1
- Crate publication failing because the version of cargo in the task-boot image is too old
- After publishing a crate and before publishing the next that depends on it, wait until crates.io processes the upload
- Cargo.lock is not uploaded as it can't be found at the specified path
- Number of comment lines should be independent from the presence of CRLF vs LF
- Add metrics explanation to the documentation HOT 1
- Duplicate short option names for --host and --help makes debug build panic
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 rust-code-analysis.