fix: remove COMMONAPI_METHOD_EXPORT from enum class in Logger.hpp#60
Open
aki1770-del wants to merge 1 commit into
Open
fix: remove COMMONAPI_METHOD_EXPORT from enum class in Logger.hpp#60aki1770-del wants to merge 1 commit into
aki1770-del wants to merge 1 commit into
Conversation
Applying COMMONAPI_METHOD_EXPORT (a visibility/dllexport attribute macro) to an enum class definition is not valid C++. MSVC rejects it with C2059 and GCC/Clang emit a warning. Enum classes do not have a linkage attribute in the same sense as functions or variables; the symbols produced by switching on a scoped enum value are controlled by the enclosing class's export attribute (Logger is already COMMONAPI_EXPORT_CLASS_EXPLICIT). Remove the misplaced macro from the enum class declaration. Fixes COVESA#26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
COMMONAPI_METHOD_EXPORT(a visibility/dllexport attribute macro) is applied to theenum class Leveldeclaration insideLogger:This is not valid C++. MSVC rejects it with C2059 ("syntax error: '__declspec(dllexport)'"). GCC/Clang emit a warning and silently ignore it. An enum class has no separate linkage attribute — its visibility is controlled by the enclosing class's export decoration (Logger is already marked
COMMONAPI_EXPORT_CLASS_EXPLICIT).Reported in #26.
Fix
Remove the misplaced
COMMONAPI_METHOD_EXPORTfrom theenum class Leveldeclaration.Testing
Loggerclass export decoration unchanged — symbols still exported viaCOMMONAPI_EXPORT_CLASS_EXPLICIT