You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Synopsis:
When compiling a program in release mode, treating warnings as errors (-DNDEBUG -Wall -Werror), the use of DCHECK_NOTNULL results in "expression result unused" errors when compiling with clang.
Steps to reproduce:
Enter the following contents in a file named test.cc:
#include"glog/logging.h"voidFoo(int* x) {
DCHECK_NOTNULL(x);
*x = 42;
}
intmain() {
int a = 0;
Foo(&a);
}
Compile the program with:
clang++ -Werror -Wall test.cc -lglog -o test -DNDEBUG
This will result in the following output:
test.cc:4:18: error: expression result unused [-Werror,-Wunused-value]
DCHECK_NOTNULL(x);
^
/usr/include/glog/logging.h:1042:30: note: expanded from macro 'DCHECK_NOTNULL'#define DCHECK_NOTNULL(val) (val)
^~~
1 error generated.
The text was updated successfully, but these errors were encountered:
joydeep-b
changed the title
DCHECK* generates "expression result unused" errors with clang in strict compilation mode
DCHECK_NOTNULL generates "expression result unused" errors with clang in strict compilation mode
Mar 25, 2017
Synopsis:
When compiling a program in release mode, treating warnings as errors (
-DNDEBUG -Wall -Werror
), the use of DCHECK_NOTNULL results in "expression result unused" errors when compiling with clang.Steps to reproduce:
test.cc
:clang++ -Werror -Wall test.cc -lglog -o test -DNDEBUG
This will result in the following output:
The text was updated successfully, but these errors were encountered: