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

logging.h re-enables disabled warning C4275 (MSVC) #253

Closed
bjornpiltz opened this issue Oct 18, 2017 · 0 comments
Closed

logging.h re-enables disabled warning C4275 (MSVC) #253

bjornpiltz opened this issue Oct 18, 2017 · 0 comments
Labels

Comments

@bjornpiltz
Copy link

The following source file

#include <QString>
#include <glog/logging.h>
#include <QException>

emits a warning, even though both Qt and glog explicitly disable that warning.

1>c:\qt\5.9.1\msvc2017_64\include\qtcore\qexception.h(60): warning C4275: non dll-interface class 'std::exception' used as base for dll-interface class 'QException'
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include\vcruntime_exception.h(43): note: see declaration of 'std::exception'
1>c:\qt\5.9.1\msvc2017_64\include\qtcore\qexception.h(59): note: see declaration of 'QException'

The following lines in logging.h are the culprits:

# pragma warning(disable: 4275)
  class GOOGLE_GLOG_DLL_DECL LogStream : public std::ostream {
# pragma warning(default: 4275)

They can be fixed as follows.

# pragma warning (push)
# pragma warning(disable: 4275)
  class GOOGLE_GLOG_DLL_DECL LogStream : public std::ostream {
# pragma warning (pop)

There seems to be a consensus that this is the right way to do it.

shinh added a commit that referenced this issue Oct 20, 2017
#253: Use MS preprocessor idiom to disable warning
@sergiud sergiud added the bug label Oct 23, 2017
@sergiud sergiud closed this as completed Nov 4, 2017
qzmfranklin pushed a commit to qzmfranklin/glog that referenced this issue Dec 14, 2017
durswd pushed a commit to durswd/glog that referenced this issue Sep 2, 2019
durswd pushed a commit to durswd/glog that referenced this issue Sep 2, 2019
google#253: Use MS preprocessor idiom to disable warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants