diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-05-05 14:51:27 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-05-05 14:51:27 +0200 |
commit | 90e9723f27a165f9d0f36b790ba4da8a1d1d8b7e (patch) | |
tree | 1e0c17082d1eb46bd711be1e9500ef6eca16450f | |
parent | b48ea94548702786dc66067546e85de0d71efe27 (diff) | |
parent | b2366908835cda4817196f554ba4c8bfa55a3719 (diff) | |
download | rules-cc-90e9723f27a165f9d0f36b790ba4da8a1d1d8b7e.tar.gz |
Merge branch 'rules/oss' into rules/rules-cc-rules
-rw-r--r-- | CC/auto/RULES | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/CC/auto/RULES b/CC/auto/RULES index 7d27ff6..e04289c 100644 --- a/CC/auto/RULES +++ b/CC/auto/RULES @@ -97,7 +97,8 @@ , "pairs. The first element of each pair is the define name and the" , "second argument is another pair. This pair's first value is the C" , "symbol to search for and the second value is a list with the header" - , "file names to consider for searching." + , "file names to consider for searching. If the header file defines the" + , "symbol as a macro it is considered available and assumed to work." ] , "have_cxxsymbol": [ "Set a define to \"1\" if the specified C++ symbol is defined by one of" @@ -105,7 +106,8 @@ , "pairs. The first element of each pair is the define name and the" , "second argument is another pair. This pair's first value is the C++" , "symbol to search for and the second value is a list with the header" - , "file names to consider for searching." + , "file names to consider for searching. If the header file defines the" + , "symbol as a macro it is considered available and assumed to work." ] , "size_ctype": [ "Set a define to size of the specified C type. Must contain a list of" @@ -300,13 +302,21 @@ , "shift" , "DEFINE=\"/* #undef $DEF */\"" , "for INC in \"$@\"; do" - , " cat > test.$LANG << EOF" + , " cat > test_symbol.$LANG << EOF" , "#include \"$INC\"" - , "#ifndef $SYMBOL" , "void* __test = &$SYMBOL;" + , "EOF" + , " if $CC @$LANG.flags -c test_symbol.$LANG -I ./include 2>/dev/null; then" + , " DEFINE=\"#define $DEF 1\"" + , " break" + , " fi" + , " cat > test_macro.$LANG << EOF" + , "#include \"$INC\"" + , "#ifndef $SYMBOL" + , "#error not defined as macro" , "#endif" , "EOF" - , " if $CC @$LANG.flags -c test.$LANG -I ./include 2>/dev/null; then" + , " if $CC @$LANG.flags -c test_macro.$LANG -I ./include 2>/dev/null; then" , " DEFINE=\"#define $DEF 1\"" , " break" , " fi" |