xref: /aosp_15_r20/external/libchrome-gestures/include/compiler_specific.h (revision aed3e5085e770be5b69ce25295ecf6ddf906af95)
1 // Copyright 2014 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef GESTURES_COMPILER_SPECIFIC_H_
6 #define GESTURES_COMPILER_SPECIFIC_H_
7 
8 // Compiler detection.
9 #if defined(__GNUC__)
10 #define COMPILER_GCC 1
11 #elif defined(_MSC_VER)
12 #define COMPILER_MSVC 1
13 #else
14 #error Please add support for your compiler in compiler_specific.h
15 #endif
16 
17 // Tell the compiler a function is using a printf-style format string.
18 // |format_param| is the one-based index of the format string parameter;
19 // |dots_param| is the one-based index of the "..." parameter.
20 // For v*printf functions (which take a va_list), pass 0 for dots_param.
21 // (This is undocumented but matches what the system C headers do.)
22 #if defined(COMPILER_GCC)
23 #define PRINTF_FORMAT(format_param, dots_param) \
24     __attribute__((format(printf, format_param, dots_param)))
25 #else
26 #define PRINTF_FORMAT(format_param, dots_param)
27 #endif
28 
29 #endif  // GESTURES_COMPILER_SPECIFIC_H_
30