Skip to content

Checked-c-convert: Static modifier removed from function declaration when return value converted #524

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

Closed
AnnaKornfeldSimpson opened this issue Jul 11, 2018 · 3 comments
Assignees
Labels
bug This labels issues that are bugs.

Comments

@AnnaKornfeldSimpson
Copy link
Collaborator

Static modifiers preceding the return type of a function are removed from the declaration when the return type is converted from * to _Ptr.

Example: parson.checked.c:94
Original code: parson.c:94
I have not yet seen a specific error message for this yet; I just noticed while comparing sources.

To use this test case:

  • Clone https://github.com/AnnaKornfeldSimpson/parson
  • Check out the snapshotWeUse branch
  • make test to build the original code. make testchecked to build with the copies produced by checked-c-convert.
  • convert.sh runs checked-c-convert on the original code and outputs to *checked* files. If you re-run it, also edit parson.checked.c to use parson.checked.h. convert.sh may need modifications to run in Windows.
  • Compiler errors can be compared with compilerErrors.txt (produced on a Ubuntu system, not sure if it will perfectly match in Windows)
@AnnaKornfeldSimpson
Copy link
Collaborator Author

I'm not sure I know precisely all the implications of static on a function in c.
@dtarditi Is this a correctness issue or more stylistic?

@dtarditi
Copy link
Member

@AnnaKornfeldSimpson, it could cause name collisions. A static function is local to the C file being compiled. If the static modifier is dropped, the function becomes globally scoped. This could cause a name collision if two separate files defined the same static function.

@dtarditi
Copy link
Member

dtarditi commented Sep 2, 2019

The convert tool has been mostly rewritten (see PR #642). Please reopen this issue if it still exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This labels issues that are bugs.
Projects
None yet
Development

No branches or pull requests

3 participants