diff options
author | Ben Ashbaugh <ben.ashbaugh@intel.com> | 2022-09-30 17:05:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-30 17:05:43 -0700 |
commit | a51354a85f41d203e755124ad51ae3425933df45 (patch) | |
tree | 9644b0d489390ee2998ef0f00d2809702b8fbd9a | |
parent | 5e2f8c66476bcf60eb8c2921807e34efb30294ee (diff) | |
download | OpenCL-Headers-a51354a85f41d203e755124ad51ae3425933df45.tar.gz |
use cinttypes instead of inttypes.h header for C++ tests (#209)upstream/v2022.09.30
-rw-r--r-- | tests/test_headers.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test_headers.c b/tests/test_headers.c index 71f79bb..460a182 100644 --- a/tests/test_headers.c +++ b/tests/test_headers.c @@ -1,5 +1,5 @@ // -// Copyright (c) 2020 The Khronos Group Inc. +// Copyright (c) 2020-2022 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,7 +14,17 @@ // limitations under the License. // +/* +Some versions of inttypes.h required defining the macro __STDC_FORMAT_MACROS to +use the format macros for C++ compiles, but not all. To improve robustness we +will use inttypes.h for C compiles and cinttypes for C++ compiles. +*/ +#if defined(__cplusplus) +#include <cinttypes> +#else #include <inttypes.h> +#endif + #include <stdio.h> #include "CL/cl.h" |