diff --git a/CHANGELOG.md b/CHANGELOG.md index e3eaa6c..d578d05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/ccc/print_cpp.cpp b/src/ccc/print_cpp.cpp index d354fa2..96d389c 100644 --- a/src/ccc/print_cpp.cpp +++ b/src/ccc/print_cpp.cpp @@ -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); }