1 /* 2 * SPDX-License-Identifier: Apache-2.0 3 * 4 * Copyright (c) 2017 Nordic Semiconductor ASA 5 * 6 * Original license: 7 * 8 * Licensed to the Apache Software Foundation (ASF) under one 9 * or more contributor license agreements. See the NOTICE file 10 * distributed with this work for additional information 11 * regarding copyright ownership. The ASF licenses this file 12 * to you under the Apache License, Version 2.0 (the 13 * "License"); you may not use this file except in compliance 14 * with the License. You may obtain a copy of the License at 15 * 16 * http://www.apache.org/licenses/LICENSE-2.0 17 * 18 * Unless required by applicable law or agreed to in writing, 19 * software distributed under the License is distributed on an 20 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21 * KIND, either express or implied. See the License for the 22 * specific language governing permissions and limitations 23 * under the License. 24 */ 25 26 #ifndef H_IGNORE_ 27 #define H_IGNORE_ 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 /** 34 * These macros prevent the "set but not used" warnings for log writes below 35 * the log level. 36 */ 37 38 #define IGN_1(X) ((void)(X)) 39 #define IGN_2(X, ...) ((void)(X));IGN_1(__VA_ARGS__) 40 #define IGN_3(X, ...) ((void)(X));IGN_2(__VA_ARGS__) 41 #define IGN_4(X, ...) ((void)(X));IGN_3(__VA_ARGS__) 42 #define IGN_5(X, ...) ((void)(X));IGN_4(__VA_ARGS__) 43 #define IGN_6(X, ...) ((void)(X));IGN_5(__VA_ARGS__) 44 #define IGN_7(X, ...) ((void)(X));IGN_6(__VA_ARGS__) 45 #define IGN_8(X, ...) ((void)(X));IGN_7(__VA_ARGS__) 46 #define IGN_9(X, ...) ((void)(X));IGN_8(__VA_ARGS__) 47 #define IGN_10(X, ...) ((void)(X));IGN_9(__VA_ARGS__) 48 #define IGN_11(X, ...) ((void)(X));IGN_10(__VA_ARGS__) 49 #define IGN_12(X, ...) ((void)(X));IGN_11(__VA_ARGS__) 50 #define IGN_13(X, ...) ((void)(X));IGN_12(__VA_ARGS__) 51 #define IGN_14(X, ...) ((void)(X));IGN_13(__VA_ARGS__) 52 #define IGN_15(X, ...) ((void)(X));IGN_14(__VA_ARGS__) 53 #define IGN_16(X, ...) ((void)(X));IGN_15(__VA_ARGS__) 54 #define IGN_17(X, ...) ((void)(X));IGN_16(__VA_ARGS__) 55 #define IGN_18(X, ...) ((void)(X));IGN_17(__VA_ARGS__) 56 #define IGN_19(X, ...) ((void)(X));IGN_18(__VA_ARGS__) 57 #define IGN_20(X, ...) ((void)(X));IGN_19(__VA_ARGS__) 58 59 #define GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, \ 60 _13, _14, _15, _16, _17, _18, _19, _20, NAME, ...) NAME 61 #define IGNORE(...) \ 62 GET_MACRO(__VA_ARGS__, IGN_20, IGN_19, IGN_18, IGN_17, IGN_16, IGN_15, \ 63 IGN_14, IGN_13, IGN_12, IGN_11, IGN_10, IGN_9, IGN_8, IGN_7, \ 64 IGN_6, IGN_5, IGN_4, IGN_3, IGN_2, IGN_1)(__VA_ARGS__) 65 66 #ifdef __cplusplus 67 } 68 #endif 69 70 #endif 71