[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / utils / params_check_macros.h
blob550e229e7c6d76f8a27f9b255fc7bd29947286e5
1 /*
2 * Copyright (C) 2014-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 // macros for gcc, clang & others
12 #ifndef PARAM1_PRINTF_FORMAT
13 #ifdef __GNUC__
14 // for use in functions that take printf format string as first parameter and additional printf parameters as second parameter
15 // for example: int myprintf(const char* format, ...) PARAM1_PRINTF_FORMAT;
16 #define PARAM1_PRINTF_FORMAT __attribute__((format(printf,1,2)))
18 // for use in functions that take printf format string as second parameter and additional printf parameters as third parameter
19 // for example: bool log_string(int logLevel, const char* format, ...) PARAM2_PRINTF_FORMAT;
20 // note: all non-static class member functions take pointer to class object as hidden first parameter
21 #define PARAM2_PRINTF_FORMAT __attribute__((format(printf,2,3)))
23 // for use in functions that take printf format string as third parameter and additional printf parameters as fourth parameter
24 // note: all non-static class member functions take pointer to class object as hidden first parameter
25 // for example: class A { bool log_string(int logLevel, const char* functionName, const char* format, ...) PARAM3_PRINTF_FORMAT; }
26 #define PARAM3_PRINTF_FORMAT __attribute__((format(printf,3,4)))
28 // for use in functions that take printf format string as fourth parameter and additional printf parameters as fifth parameter
29 // note: all non-static class member functions take pointer to class object as hidden first parameter
30 // for example: class A { bool log_string(int logLevel, const char* functionName, int component, const char* format, ...) PARAM4_PRINTF_FORMAT; }
31 #define PARAM4_PRINTF_FORMAT __attribute__((format(printf,4,5)))
32 #else // ! __GNUC__
33 #define PARAM1_PRINTF_FORMAT
34 #define PARAM2_PRINTF_FORMAT
35 #define PARAM3_PRINTF_FORMAT
36 #define PARAM4_PRINTF_FORMAT
37 #endif // ! __GNUC__
38 #endif // PARAM1_PRINTF_FORMAT
40 // macros for VC
41 // VC check parameters only when "Code Analysis" is called
42 #ifndef PRINTF_FORMAT_STRING
43 #ifdef _MSC_VER
44 #include <sal.h>
46 // for use in any function that take printf format string and parameters
47 // for example: bool log_string(int logLevel, PRINTF_FORMAT_STRING const char* format, ...);
48 #define PRINTF_FORMAT_STRING _In_z_ _Printf_format_string_
50 // specify that parameter must be zero-terminated string
51 // for example: void SetName(IN_STRING const char* newName);
52 #define IN_STRING _In_z_
54 // specify that parameter must be zero-terminated string or NULL
55 // for example: bool SetAdditionalName(IN_OPT_STRING const char* addName);
56 #define IN_OPT_STRING _In_opt_z_
57 #else // ! _MSC_VER
58 #define PRINTF_FORMAT_STRING
59 #define IN_STRING
60 #define IN_OPT_STRING
61 #endif // ! _MSC_VER
62 #endif // PRINTF_FORMAT_STRING