Ticket #48471: define_non_standard_clang_macros.patch

File define_non_standard_clang_macros.patch, 12.5 KB (added by MoogHub, 9 years ago)

Patch that adds additional fixes to fixincludes.

  • fixincludes/inclhack.def

    old new  
    11411141    test_text = "#define _Noreturn      [[noreturn]]";
    11421142};
    11431143
     1144/*
     1145 * Add definitions of non-standard (clang) macros.
     1146 */
     1147fix = {
     1148    hackname  = clang_macro___has_builtin;
     1149    select    = "__has_builtin";
     1150    bypass    = "#[ \t]*define[ \t]+__has_builtin";
     1151    c_fix     = wrap;
     1152    c_fix_arg = "#ifndef __has_builtin\n"
     1153                "  #define __has_builtin(x) 0\n"
     1154                "#endif\n";
     1155    test_text = "#if __has_builtin(__builtin_trap)\n"
     1156                "  __builtin_trap();\n"
     1157                "#else\n"
     1158                "  abort();\n"
     1159                "#endif\n";
     1160};
     1161fix = {
     1162    hackname  = clang_macro___has_feature;
     1163    select    = "__has_feature";
     1164    bypass    = "#[ \t]*define[ \t]+__has_feature";
     1165    c_fix     = wrap;
     1166    c_fix_arg = "#ifndef __has_feature\n"
     1167                "  #define __has_feature(x) 0\n"
     1168                "#endif\n";
     1169    test_text = "#if __has_feature(cxx_rvalue_references)\n"
     1170                "  // This code will only be compiled with the -std=c++11 and -std=gnu++11\n"
     1171                "  // options, because rvalue references are only standardized in C++11.\n"
     1172                "#endif\n";
     1173};
     1174fix = {
     1175    hackname  = clang_macro___has_cpp_attribute;
     1176    select    = "__has_cpp_attribute";
     1177    bypass    = "#[ \t]*define[ \t]+__has_cpp_attribute";
     1178    c_fix     = wrap;
     1179    c_fix_arg = "#ifndef __has_cpp_attribute\n"
     1180                "  #define __has_cpp_attribute(x) 0\n"
     1181                "#endif\n";
     1182    test_text = "#if __has_cpp_attribute(clang::fallthrough)\n"
     1183                "  #define FALLTHROUGH [[clang::fallthrough]]\n"
     1184                "#else\n"
     1185                "  #define FALLTHROUGH\n"
     1186                "#endif\n";
     1187};
     1188fix = {
     1189    hackname  = clang_macro___has_attribute;
     1190    select    = "__has_attribute";
     1191    bypass    = "#[ \t]*define[ \t]+__has_attribute";
     1192    c_fix     = wrap;
     1193    c_fix_arg = "#ifndef __has_attribute\n"
     1194                "  #define __has_attribute(x) 0\n"
     1195                "#endif\n";
     1196    test_text = "#if __has_attribute(always_inline)\n"
     1197                "  #define ALWAYS_INLINE __attribute__((always_inline))\n"
     1198                "#else\n"
     1199                "  #define ALWAYS_INLINE\n"
     1200                "#endif\n";
     1201};
     1202fix = {
     1203    hackname  = clang_macro___has_declspec_attribute;
     1204    select    = "__has_declspec_attribute";
     1205    bypass    = "#[ \t]*define[ \t]+__has_declspec_attribute";
     1206    c_fix     = wrap;
     1207    c_fix_arg = "#ifndef __has_declspec_attribute\n"
     1208                "  #define __has_declspec_attribute(x) 0\n"
     1209                "#endif\n";
     1210    test_text = "#if __has_declspec_attribute(dllexport)\n"
     1211                "  #define DLLEXPORT __declspec(dllexport)\n"
     1212                "#else\n"
     1213                "  #define DLLEXPORT\n"
     1214                "#endif\n";
     1215};
     1216
    11441217/*
    11451218 *  Fix various macros used to define ioctl numbers.
    11461219 *  The traditional syntax was:
  • fixincludes/fixincl.x

    old new  
    11/*  -*- buffer-read-only: t -*- vi: set ro:
    2  * 
     2 *
    33 * DO NOT EDIT THIS FILE   (fixincl.x)
    4  * 
    5  * It has been AutoGen-ed  December 13, 2014 at 05:31:32 AM by AutoGen 5.12
     4 *
     5 * It has been AutoGen-ed
    66 * From the definitions    inclhack.def
    77 * and the template file   fixincl
    88 */
    9 /* DO NOT SVN-MERGE THIS FILE, EITHER Sat Dec 13 05:31:32 PST 2014
     9/* DO NOT SVN-MERGE THIS FILE, EITHER Fri Oct  9 05:27:32 CEST 2015
    1010 *
    1111 * You must regenerate it.  Use the ./genfixes script.
    1212 *
     
    1515 * certain ANSI-incompatible system header files which are fixed to work
    1616 * correctly with ANSI C and placed in a directory that GNU C will search.
    1717 *
    18  * This file contains 227 fixup descriptions.
     18 * This file contains 232 fixup descriptions.
    1919 *
    2020 * See README for more information.
    2121 *
     
    20922092
    20932093/* * * * * * * * * * * * * * * * * * * * * * * * * *
    20942094 *
     2095 *  Description of Clang_Macro___Has_Builtin fix
     2096 */
     2097tSCC zClang_Macro___Has_BuiltinName[] =
     2098     "clang_macro___has_builtin";
     2099
     2100/*
     2101 *  File name selection pattern
     2102 */
     2103#define zClang_Macro___Has_BuiltinList (char*)NULL
     2104/*
     2105 *  Machine/OS name selection pattern
     2106 */
     2107#define apzClang_Macro___Has_BuiltinMachs (const char**)NULL
     2108
     2109/*
     2110 *  content selection pattern - do fix if pattern found
     2111 */
     2112tSCC zClang_Macro___Has_BuiltinSelect0[] =
     2113       "__has_builtin";
     2114
     2115/*
     2116 *  content bypass pattern - skip fix if pattern found
     2117 */
     2118tSCC zClang_Macro___Has_BuiltinBypass0[] =
     2119       "#[ \t]*define[ \t]+__has_builtin";
     2120
     2121#define    CLANG_MACRO___HAS_BUILTIN_TEST_CT  2
     2122static tTestDesc aClang_Macro___Has_BuiltinTests[] = {
     2123  { TT_NEGREP,   zClang_Macro___Has_BuiltinBypass0, (regex_t*)NULL },
     2124  { TT_EGREP,    zClang_Macro___Has_BuiltinSelect0, (regex_t*)NULL }, };
     2125
     2126/*
     2127 *  Fix Command Arguments for Clang_Macro___Has_Builtin
     2128 */
     2129static const char* apzClang_Macro___Has_BuiltinPatch[] = {
     2130    "wrap",
     2131    "#ifndef __has_builtin\n\
     2132  #define __has_builtin(x) 0\n\
     2133#endif\n",
     2134    (char*)NULL };
     2135
     2136/* * * * * * * * * * * * * * * * * * * * * * * * * *
     2137 *
     2138 *  Description of Clang_Macro___Has_Feature fix
     2139 */
     2140tSCC zClang_Macro___Has_FeatureName[] =
     2141     "clang_macro___has_feature";
     2142
     2143/*
     2144 *  File name selection pattern
     2145 */
     2146#define zClang_Macro___Has_FeatureList (char*)NULL
     2147/*
     2148 *  Machine/OS name selection pattern
     2149 */
     2150#define apzClang_Macro___Has_FeatureMachs (const char**)NULL
     2151
     2152/*
     2153 *  content selection pattern - do fix if pattern found
     2154 */
     2155tSCC zClang_Macro___Has_FeatureSelect0[] =
     2156       "__has_feature";
     2157
     2158/*
     2159 *  content bypass pattern - skip fix if pattern found
     2160 */
     2161tSCC zClang_Macro___Has_FeatureBypass0[] =
     2162       "#[ \t]*define[ \t]+__has_feature";
     2163
     2164#define    CLANG_MACRO___HAS_FEATURE_TEST_CT  2
     2165static tTestDesc aClang_Macro___Has_FeatureTests[] = {
     2166  { TT_NEGREP,   zClang_Macro___Has_FeatureBypass0, (regex_t*)NULL },
     2167  { TT_EGREP,    zClang_Macro___Has_FeatureSelect0, (regex_t*)NULL }, };
     2168
     2169/*
     2170 *  Fix Command Arguments for Clang_Macro___Has_Feature
     2171 */
     2172static const char* apzClang_Macro___Has_FeaturePatch[] = {
     2173    "wrap",
     2174    "#ifndef __has_feature\n\
     2175  #define __has_feature(x) 0\n\
     2176#endif\n",
     2177    (char*)NULL };
     2178
     2179/* * * * * * * * * * * * * * * * * * * * * * * * * *
     2180 *
     2181 *  Description of Clang_Macro___Has_Cpp_Attribute fix
     2182 */
     2183tSCC zClang_Macro___Has_Cpp_AttributeName[] =
     2184     "clang_macro___has_cpp_attribute";
     2185
     2186/*
     2187 *  File name selection pattern
     2188 */
     2189#define zClang_Macro___Has_Cpp_AttributeList (char*)NULL
     2190/*
     2191 *  Machine/OS name selection pattern
     2192 */
     2193#define apzClang_Macro___Has_Cpp_AttributeMachs (const char**)NULL
     2194
     2195/*
     2196 *  content selection pattern - do fix if pattern found
     2197 */
     2198tSCC zClang_Macro___Has_Cpp_AttributeSelect0[] =
     2199       "__has_cpp_attribute";
     2200
     2201/*
     2202 *  content bypass pattern - skip fix if pattern found
     2203 */
     2204tSCC zClang_Macro___Has_Cpp_AttributeBypass0[] =
     2205       "#[ \t]*define[ \t]+__has_cpp_attribute";
     2206
     2207#define    CLANG_MACRO___HAS_CPP_ATTRIBUTE_TEST_CT  2
     2208static tTestDesc aClang_Macro___Has_Cpp_AttributeTests[] = {
     2209  { TT_NEGREP,   zClang_Macro___Has_Cpp_AttributeBypass0, (regex_t*)NULL },
     2210  { TT_EGREP,    zClang_Macro___Has_Cpp_AttributeSelect0, (regex_t*)NULL }, };
     2211
     2212/*
     2213 *  Fix Command Arguments for Clang_Macro___Has_Cpp_Attribute
     2214 */
     2215static const char* apzClang_Macro___Has_Cpp_AttributePatch[] = {
     2216    "wrap",
     2217    "#ifndef __has_cpp_attribute\n\
     2218  #define __has_cpp_attribute(x) 0\n\
     2219#endif\n",
     2220    (char*)NULL };
     2221
     2222/* * * * * * * * * * * * * * * * * * * * * * * * * *
     2223 *
     2224 *  Description of Clang_Macro___Has_Attribute fix
     2225 */
     2226tSCC zClang_Macro___Has_AttributeName[] =
     2227     "clang_macro___has_attribute";
     2228
     2229/*
     2230 *  File name selection pattern
     2231 */
     2232#define zClang_Macro___Has_AttributeList (char*)NULL
     2233/*
     2234 *  Machine/OS name selection pattern
     2235 */
     2236#define apzClang_Macro___Has_AttributeMachs (const char**)NULL
     2237
     2238/*
     2239 *  content selection pattern - do fix if pattern found
     2240 */
     2241tSCC zClang_Macro___Has_AttributeSelect0[] =
     2242       "__has_attribute";
     2243
     2244/*
     2245 *  content bypass pattern - skip fix if pattern found
     2246 */
     2247tSCC zClang_Macro___Has_AttributeBypass0[] =
     2248       "#[ \t]*define[ \t]+__has_attribute";
     2249
     2250#define    CLANG_MACRO___HAS_ATTRIBUTE_TEST_CT  2
     2251static tTestDesc aClang_Macro___Has_AttributeTests[] = {
     2252  { TT_NEGREP,   zClang_Macro___Has_AttributeBypass0, (regex_t*)NULL },
     2253  { TT_EGREP,    zClang_Macro___Has_AttributeSelect0, (regex_t*)NULL }, };
     2254
     2255/*
     2256 *  Fix Command Arguments for Clang_Macro___Has_Attribute
     2257 */
     2258static const char* apzClang_Macro___Has_AttributePatch[] = {
     2259    "wrap",
     2260    "#ifndef __has_attribute\n\
     2261  #define __has_attribute(x) 0\n\
     2262#endif\n",
     2263    (char*)NULL };
     2264
     2265/* * * * * * * * * * * * * * * * * * * * * * * * * *
     2266 *
     2267 *  Description of Clang_Macro___Has_Declspec_Attribute fix
     2268 */
     2269tSCC zClang_Macro___Has_Declspec_AttributeName[] =
     2270     "clang_macro___has_declspec_attribute";
     2271
     2272/*
     2273 *  File name selection pattern
     2274 */
     2275#define zClang_Macro___Has_Declspec_AttributeList (char*)NULL
     2276/*
     2277 *  Machine/OS name selection pattern
     2278 */
     2279#define apzClang_Macro___Has_Declspec_AttributeMachs (const char**)NULL
     2280
     2281/*
     2282 *  content selection pattern - do fix if pattern found
     2283 */
     2284tSCC zClang_Macro___Has_Declspec_AttributeSelect0[] =
     2285       "__has_declspec_attribute";
     2286
     2287/*
     2288 *  content bypass pattern - skip fix if pattern found
     2289 */
     2290tSCC zClang_Macro___Has_Declspec_AttributeBypass0[] =
     2291       "#[ \t]*define[ \t]+__has_declspec_attribute";
     2292
     2293#define    CLANG_MACRO___HAS_DECLSPEC_ATTRIBUTE_TEST_CT  2
     2294static tTestDesc aClang_Macro___Has_Declspec_AttributeTests[] = {
     2295  { TT_NEGREP,   zClang_Macro___Has_Declspec_AttributeBypass0, (regex_t*)NULL },
     2296  { TT_EGREP,    zClang_Macro___Has_Declspec_AttributeSelect0, (regex_t*)NULL }, };
     2297
     2298/*
     2299 *  Fix Command Arguments for Clang_Macro___Has_Declspec_Attribute
     2300 */
     2301static const char* apzClang_Macro___Has_Declspec_AttributePatch[] = {
     2302    "wrap",
     2303    "#ifndef __has_declspec_attribute\n\
     2304  #define __has_declspec_attribute(x) 0\n\
     2305#endif\n",
     2306    (char*)NULL };
     2307
     2308/* * * * * * * * * * * * * * * * * * * * * * * * * *
     2309 *
    20952310 *  Description of Ctrl_Quotes_Def fix
    20962311 */
    20972312tSCC zCtrl_Quotes_DefName[] =
     
    93049519 *
    93059520 *  List of all fixes
    93069521 */
    9307 #define REGEX_COUNT          265
     9522#define REGEX_COUNT          275
    93089523#define MACH_LIST_SIZE_LIMIT 187
    9309 #define FIX_COUNT            227
     9524#define FIX_COUNT            232
    93109525
    93119526/*
    93129527 *  Enumerate the fixes
     
    93599574    BROKEN_NAN_FIXIDX,
    93609575    BSD_STDIO_ATTRS_CONFLICT_FIXIDX,
    93619576    CDEF_CPLUSPLUS_FIXIDX,
     9577    CLANG_MACRO___HAS_BUILTIN_FIXIDX,
     9578    CLANG_MACRO___HAS_FEATURE_FIXIDX,
     9579    CLANG_MACRO___HAS_CPP_ATTRIBUTE_FIXIDX,
     9580    CLANG_MACRO___HAS_ATTRIBUTE_FIXIDX,
     9581    CLANG_MACRO___HAS_DECLSPEC_ATTRIBUTE_FIXIDX,
    93629582    CTRL_QUOTES_DEF_FIXIDX,
    93639583    CTRL_QUOTES_USE_FIXIDX,
    93649584    CXX_UNREADY_FIXIDX,
     
    97779997     CDEF_CPLUSPLUS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
    97789998     aCdef_CplusplusTests,   apzCdef_CplusplusPatch, 0 },
    97799999
     10000  {  zClang_Macro___Has_BuiltinName,    zClang_Macro___Has_BuiltinList,
     10001     apzClang_Macro___Has_BuiltinMachs,
     10002     CLANG_MACRO___HAS_BUILTIN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
     10003     aClang_Macro___Has_BuiltinTests,   apzClang_Macro___Has_BuiltinPatch, 0 },
     10004
     10005  {  zClang_Macro___Has_FeatureName,    zClang_Macro___Has_FeatureList,
     10006     apzClang_Macro___Has_FeatureMachs,
     10007     CLANG_MACRO___HAS_FEATURE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
     10008     aClang_Macro___Has_FeatureTests,   apzClang_Macro___Has_FeaturePatch, 0 },
     10009
     10010  {  zClang_Macro___Has_Cpp_AttributeName,    zClang_Macro___Has_Cpp_AttributeList,
     10011     apzClang_Macro___Has_Cpp_AttributeMachs,
     10012     CLANG_MACRO___HAS_CPP_ATTRIBUTE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
     10013     aClang_Macro___Has_Cpp_AttributeTests,   apzClang_Macro___Has_Cpp_AttributePatch, 0 },
     10014
     10015  {  zClang_Macro___Has_AttributeName,    zClang_Macro___Has_AttributeList,
     10016     apzClang_Macro___Has_AttributeMachs,
     10017     CLANG_MACRO___HAS_ATTRIBUTE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
     10018     aClang_Macro___Has_AttributeTests,   apzClang_Macro___Has_AttributePatch, 0 },
     10019
     10020  {  zClang_Macro___Has_Declspec_AttributeName,    zClang_Macro___Has_Declspec_AttributeList,
     10021     apzClang_Macro___Has_Declspec_AttributeMachs,
     10022     CLANG_MACRO___HAS_DECLSPEC_ATTRIBUTE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
     10023     aClang_Macro___Has_Declspec_AttributeTests,   apzClang_Macro___Has_Declspec_AttributePatch, 0 },
     10024
    978010025  {  zCtrl_Quotes_DefName,    zCtrl_Quotes_DefList,
    978110026     apzCtrl_Quotes_DefMachs,
    978210027     CTRL_QUOTES_DEF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,