Always define static_assert(...) to do nothing

Summary:public
In order to make infer more resiliant to compilation failure,
make static_assert to do nothing.

As a bonus, set _FORTIFY_SOURCE inside same file instead of command line

Reviewed By: jvillard

Differential Revision: D3133446

fb-gh-sync-id: 590f4ad
fbshipit-source-id: 590f4ad
master
Andrzej Kotulski 9 years ago committed by Facebook Github Bot 9
parent 660250dcf7
commit f1b68fe5b9

@ -39,11 +39,7 @@ done
# compiler can't elevate them to error level.
COMMAND+=("-Wno-everything")
# set _FORTIFY_SOURCE to 0 to prevent it from changing some function prototypes
# https://securityblog.redhat.com/2014/03/26/fortify-and-you/
# We always do it when building models so we should do same thing
# when building any source code
COMMAND+=("-D_FORTIFY_SOURCE=0")
COMMAND+=("-include")
COMMAND+=(${SCRIPT_DIR}/"global_defines.h")
"${COMMAND[@]}"

@ -0,0 +1,19 @@
/*
* 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.
*/
// set _FORTIFY_SOURCE to 0 to prevent it from changing some function prototypes
// https://securityblog.redhat.com/2014/03/26/fortify-and-you/
// We always do it when building models so we should do same thing
// when building any source code
#define _FORTIFY_SOURCE 0
// Make it harder for compilation to fail. When in the future, infer
// wants to use this information, it can call some builtin instead of
// the default static_assert
#define static_assert(...)

@ -13,8 +13,6 @@
#include <cstdlib>
#include <cstdio>
#define static_assert(...)
namespace infer_model {
// code compiled with infer headers is not supposed to be executed
struct AbortWhenRun {

Loading…
Cancel
Save