From d1fa1e130dd154c5642174180851f8730c792aaa Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Wed, 6 Jul 2016 09:10:57 -0700 Subject: [PATCH] Define STATIC_ANALYSIS macro when using glog/logging.h Summary: There is nice hook inside glog/logging.h for all CHECK_(GT|LT|GE|...) macros. This simplifies AST significantly which makes infer way more happy: https://github.com/google/glog/blob/cda16b3443e2d6ef88cdbbe10b9a11adea6f33fe/src/glog/logging.h.in#L722-L724 Reviewed By: jberdine Differential Revision: D3522110 fbshipit-source-id: 70c94cb --- infer/models/cpp/include/glog/logging.h | 20 ++++++++++++++++++++ infer/src/backend/config.ml | 6 ------ 2 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 infer/models/cpp/include/glog/logging.h diff --git a/infer/models/cpp/include/glog/logging.h b/infer/models/cpp/include/glog/logging.h new file mode 100644 index 000000000..49c74eee8 --- /dev/null +++ b/infer/models/cpp/include/glog/logging.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2016 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +// glog/logging library has functionally equivalent but simpler +// definitions of some CHECK_* macros when STATIC_ANALYSIS is defined. +// Since infer wants those definitions, define the macro before including +// glog/logging.h +#ifndef STATIC_ANALYSIS +#define STATIC_ANALYSIS +#include_next +#undef STATIC_ANALYSIS +#else +#include_next +#endif diff --git a/infer/src/backend/config.ml b/infer/src/backend/config.ml index d0b074a22..80f1cf804 100644 --- a/infer/src/backend/config.ml +++ b/infer/src/backend/config.ml @@ -59,12 +59,6 @@ let whitelisted_cpp_methods = [ ["std"; "max"]; ["std"; "__less"]; ["google"; "CheckNotNull"]; - ["google"; "GetReferenceableValue"]; - ["google"; "Check_NEImpl"]; - ["google"; "Check_LEImpl"]; - ["google"; "Check_GTImpl"]; - ["google"; "Check_GEImpl"]; - ["google"; "Check_EQImpl"] ]