1 /* |
1 /* |
2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
280 // Portability macros |
280 // Portability macros |
281 #define PRAGMA_INTERFACE #pragma interface |
281 #define PRAGMA_INTERFACE #pragma interface |
282 #define PRAGMA_IMPLEMENTATION #pragma implementation |
282 #define PRAGMA_IMPLEMENTATION #pragma implementation |
283 #define VALUE_OBJ_CLASS_SPEC |
283 #define VALUE_OBJ_CLASS_SPEC |
284 |
284 |
|
285 #ifndef ATTRIBUTE_PRINTF |
|
286 #define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs))) |
|
287 #endif |
|
288 |
|
289 #define PRAGMA_FORMAT_NONLITERAL_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") _Pragma("GCC diagnostic ignored \"-Wformat-security\"") |
|
290 #define PRAGMA_FORMAT_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat\"") |
|
291 |
|
292 #if defined(__clang_major__) && (__clang_major__ >= 4 || (__clang_major__ >= 3 && __clang_minor__ >= 1)) || (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6) |
|
293 // Tested to work with clang version 3.1 and better. |
|
294 #define PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push") |
|
295 #define PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop") |
|
296 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL |
|
297 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED |
|
298 |
|
299 // Hack to deal with gcc yammering about non-security format stuff |
|
300 #else |
|
301 // Old versions of gcc don't do push/pop, also do not cope with this pragma within a function |
|
302 // One method does so much varied printing that it is decorated with both internal and external |
|
303 // versions of the macro-pragma to obtain better checking with newer compilers. |
|
304 #define PRAGMA_DIAG_PUSH |
|
305 #define PRAGMA_DIAG_POP |
|
306 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED |
|
307 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL |
|
308 #endif |
|
309 |
|
310 #ifndef __clang_major__ |
|
311 #define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC _Pragma("GCC diagnostic ignored \"-Wformat\"") _Pragma("GCC diagnostic error \"-Wformat-nonliteral\"") _Pragma("GCC diagnostic error \"-Wformat-security\"") |
|
312 #endif |
|
313 |
285 #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95) |
314 #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95) |
286 #define TEMPLATE_TABLE_BUG |
315 #define TEMPLATE_TABLE_BUG |
287 #endif |
316 #endif |
288 #if (__GNUC__ == 2) && (__GNUC_MINOR__ >= 96) |
317 #if (__GNUC__ == 2) && (__GNUC_MINOR__ >= 96) |
289 #define CONST_SDM_BUG |
318 #define CONST_SDM_BUG |