From 1bed5d8ee498c1d4a5c0a8fce9a8172cb880f633 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 7 Nov 2022 09:59:12 +0100 Subject: [PATCH] vty/logging.h: wrap Wstrict-prototypes in Wpragma MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building osmo-pcu and osmo-trx with Werror, the build is currently failing at -Wstrict-prototypes. logging.h gets included in c++ code, and in c++ this is the default, so gcc warns about the option not being valid in c++. In file included from pcu_main.cpp:41: …/vty/logging.h:10:32: warning: option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [-Wpragmas] Related: https://stackoverflow.com/a/6699884 Change-Id: I9e069bb72856b437c142c11e67202e058e6eb3aa --- include/osmocom/vty/logging.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/osmocom/vty/logging.h b/include/osmocom/vty/logging.h index 9be96e561..459ed60b5 100644 --- a/include/osmocom/vty/logging.h +++ b/include/osmocom/vty/logging.h @@ -7,11 +7,16 @@ struct log_info; #pragma GCC diagnostic push +/* use -Wpragma, so the build doesn't fail in c++ files of osmo-pcu and + * osmo-trx including this header with: + * 'option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++' */ +#pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Wstrict-prototypes" /* note this undefined argument declaration is intentional. There used * to be an argument until 2017 which we no longer need .*/ void logging_vty_add_cmds(); #pragma GCC diagnostic pop +#pragma GCC diagnostic pop void logging_vty_add_deprecated_subsys(void *ctx, const char *name); struct vty; struct log_target *osmo_log_vty2tgt(struct vty *vty);