Skip to content

Commit

Permalink
Fix the static keyword being missing in the output for global variables
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoticgd committed Aug 8, 2024
1 parent f698159 commit 303e81e
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 303e81e

Please sign in to comment.