Skip to content

Commit

Permalink
Merge pull request #221 from chaoticgd/printstatic
Browse files Browse the repository at this point in the history
Fix the static keyword being missing in the output for global variables
  • Loading branch information
chaoticgd authored Aug 8, 2024
2 parents f698159 + 303e81e commit 213ed8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## v2.1

- Variable symbols are no longer incorrectly deduplicated as if they were types.
- The static keyword is no longer missing from the output for static global variables.
- Structs defined inside global variable definitions are now printed with the correct C++ syntax.
- Fixed an issue where null addresses would be handled incorrectly.
- stdump: Added `--sort-by-address` option.
Expand Down
4 changes: 3 additions & 1 deletion src/ccc/print_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,9 @@ void CppPrinter::global_variable(

global_storage_comment(symbol.storage, symbol.address());

if(m_config.make_globals_extern) {
if(symbol.storage_class != STORAGE_CLASS_NONE) {
print_cpp_storage_class(out, symbol.storage_class);
} else if(m_config.make_globals_extern) {
print_cpp_storage_class(out, STORAGE_CLASS_EXTERN);
}

Expand Down

0 comments on commit 213ed8b

Please sign in to comment.