Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed C++ logger enum names to avoid conflicts with compiler macros #4664

Merged
merged 3 commits into from
Jul 5, 2019

Conversation

merlimat
Copy link
Contributor

@merlimat merlimat commented Jul 2, 2019

Motivation

Fixes #4655

Some compiler will have defined a macro for DEBUG and it will clash with the enum value name. Adding prefix to avoid the macro replacement.

@merlimat merlimat added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Jul 2, 2019
@merlimat merlimat added this to the 2.4.1 milestone Jul 2, 2019
@merlimat merlimat self-assigned this Jul 2, 2019
@merlimat
Copy link
Contributor Author

merlimat commented Jul 3, 2019

retest this please

@merlimat
Copy link
Contributor Author

merlimat commented Jul 3, 2019

run cpp tests
run integration tests

@sijie sijie merged commit da4e932 into apache:master Jul 5, 2019
@merlimat merlimat deleted the cpp-debug branch July 8, 2019 17:08
sijie pushed a commit that referenced this pull request Jul 19, 2019
### Motivation

If trying to build master C++ code with the `USE_LOG4CXX` flag turned ON, compilation errors occur:
```
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc: In static member function ‘static log4cxx::LevelPtr pulsar::Log4CxxLogger::getLevel(pulsar::Logger::Level)’:
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:53:18: error: ‘DEBUG’ was not declared in this scope
             case DEBUG:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:55:18: error: ‘INFO’ was not declared in this scope
             case INFO:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:57:18: error: ‘WARN’ was not declared in this scope
             case WARN:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:59:18: error: ‘ERROR’ was not declared in this scope
             case ERROR:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_DEBUG’ not handled in switch [-Werror=switch]
         switch (level) {
                ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_INFO’ not handled in switch [-Werror=switch]
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_WARN’ not handled in switch [-Werror=switch]
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_ERROR’ not handled in switch [-Werror=switch]
cc1plus: some warnings being treated as errors
make[2]: *** [lib/CMakeFiles/pulsarStatic.dir/Log4cxxLogger.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
```

This is because the enum values renamed in #4664 are still used in `Log4cxxLogger.cc`.

### Modifications

Fixed the enum values used in `Log4cxxLogger.cc` by adding the prefix `LEVEL_`.
easyfan pushed a commit to easyfan/pulsar that referenced this pull request Jul 26, 2019
…apache#4664)

### Motivation

Fixes apache#4655 

Some compiler will have defined a macro for `DEBUG` and it will clash with the enum value name. Adding prefix to avoid the macro replacement.
easyfan pushed a commit to easyfan/pulsar that referenced this pull request Jul 26, 2019
### Motivation

If trying to build master C++ code with the `USE_LOG4CXX` flag turned ON, compilation errors occur:
```
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc: In static member function ‘static log4cxx::LevelPtr pulsar::Log4CxxLogger::getLevel(pulsar::Logger::Level)’:
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:53:18: error: ‘DEBUG’ was not declared in this scope
             case DEBUG:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:55:18: error: ‘INFO’ was not declared in this scope
             case INFO:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:57:18: error: ‘WARN’ was not declared in this scope
             case WARN:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:59:18: error: ‘ERROR’ was not declared in this scope
             case ERROR:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_DEBUG’ not handled in switch [-Werror=switch]
         switch (level) {
                ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_INFO’ not handled in switch [-Werror=switch]
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_WARN’ not handled in switch [-Werror=switch]
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_ERROR’ not handled in switch [-Werror=switch]
cc1plus: some warnings being treated as errors
make[2]: *** [lib/CMakeFiles/pulsarStatic.dir/Log4cxxLogger.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
```

This is because the enum values renamed in apache#4664 are still used in `Log4cxxLogger.cc`.

### Modifications

Fixed the enum values used in `Log4cxxLogger.cc` by adding the prefix `LEVEL_`.
jiazhai pushed a commit that referenced this pull request Aug 28, 2019
…#4664)

### Motivation

Fixes #4655

Some compiler will have defined a macro for `DEBUG` and it will clash with the enum value name. Adding prefix to avoid the macro replacement.
(cherry picked from commit da4e932)
jiazhai pushed a commit that referenced this pull request Aug 28, 2019
### Motivation

If trying to build master C++ code with the `USE_LOG4CXX` flag turned ON, compilation errors occur:
```
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc: In static member function ‘static log4cxx::LevelPtr pulsar::Log4CxxLogger::getLevel(pulsar::Logger::Level)’:
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:53:18: error: ‘DEBUG’ was not declared in this scope
             case DEBUG:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:55:18: error: ‘INFO’ was not declared in this scope
             case INFO:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:57:18: error: ‘WARN’ was not declared in this scope
             case WARN:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:59:18: error: ‘ERROR’ was not declared in this scope
             case ERROR:
                  ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_DEBUG’ not handled in switch [-Werror=switch]
         switch (level) {
                ^
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_INFO’ not handled in switch [-Werror=switch]
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_WARN’ not handled in switch [-Werror=switch]
/tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_ERROR’ not handled in switch [-Werror=switch]
cc1plus: some warnings being treated as errors
make[2]: *** [lib/CMakeFiles/pulsarStatic.dir/Log4cxxLogger.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
```

This is because the enum values renamed in #4664 are still used in `Log4cxxLogger.cc`.

### Modifications

Fixed the enum values used in `Log4cxxLogger.cc` by adding the prefix `LEVEL_`.

(cherry picked from commit af8ea71)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build fails including Logger.h
2 participants