Skip to content

fix: remove COMMONAPI_METHOD_EXPORT from enum class in Logger.hpp#60

Open
aki1770-del wants to merge 1 commit into
COVESA:masterfrom
aki1770-del:fix/commonapi-export-enum-26
Open

fix: remove COMMONAPI_METHOD_EXPORT from enum class in Logger.hpp#60
aki1770-del wants to merge 1 commit into
COVESA:masterfrom
aki1770-del:fix/commonapi-export-enum-26

Conversation

@aki1770-del
Copy link
Copy Markdown

Problem

COMMONAPI_METHOD_EXPORT (a visibility/dllexport attribute macro) is applied to the enum class Level declaration inside Logger:

enum class Level : std::uint8_t COMMONAPI_METHOD_EXPORT {

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_EXPORT from the enum class Level declaration.

Testing

  • Verified the header parses correctly under GCC and is MSVC-clean
  • Logger class export decoration unchanged — symbols still exported via COMMONAPI_EXPORT_CLASS_EXPLICIT

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant