Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Support for C99 syntax #12

Open
mcandre opened this issue Jan 11, 2019 · 6 comments
Open

Enhancement: Support for C99 syntax #12

mcandre opened this issue Jan 11, 2019 · 6 comments

Comments

@mcandre
Copy link

mcandre commented Jan 11, 2019

C has grown since the days of K&R C, with new syntax and semantics. Could splint fix the parser to handle newer C code, such as variable declarations in loop initializer statements?

@oxr463
Copy link

oxr463 commented Jan 12, 2019

See: #11 (comment)

@ravenexp
Copy link
Collaborator

There was a patch for C99 declaration support floating around on the old sourceforge project mailing list (or the bug tracker... I don't remember).
But it also caused the number of shift/reduce conflicts in the bison grammar to explode and I've never tested it on C99 code myself.

On the other hand, splint has an extensive test suite that will likely catch the possible regressions caused by the grammar patch, so maybe someone brave could dig it out and make it work...

@bpringlemeir
Copy link
Collaborator

I thought I had applied this patch. At least support for variables declared part way through a function. Like for(int i = 0; i < 10; i++). Maybe I was just working on it. Part of the issue is not just the grammar. You also have to fix up spints management in the rules. Splint doesn't scale well when things are deeply nested, etc. For this reason I wanted to use a gcc plugin, which may solve many lex/parse issues.

@bpringlemeir
Copy link
Collaborator

See: https://gcc.gnu.org/c99status.html for list of what this may entail. Each item there is possibly weeks of work. I think the issue you specifically mention is "mixed declarations and code" which is the same as issue #7. Other features of c99 are useful as well. I think it is best to proceed with a compliance chart like this to say what is supported.

@cooljeanius
Copy link

personally the C++-style comments is the C99 feature I think would be most helpful; the fact that splint doesn't support them (or at least didn't support them when I last checked) is (part of) why I opened this GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80529

@cooper1025
Copy link

I thought I had applied this patch. At least support for variables declared part way through a function. Like for(int i = 0; i < 10; i++). Maybe I was just working on it. Part of the issue is not just the grammar. You also have to fix up spints management in the rules. Splint doesn't scale well when things are deeply nested, etc. For this reason I wanted to use a gcc plugin, which may solve many lex/parse issues.

Hi bpringlemei, seems that master branch do not have this patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants