From patchwork Thu Dec 7 03:59:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 81576 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 66235385734E for ; Thu, 7 Dec 2023 03:59:57 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 8CAE63857C69 for ; Thu, 7 Dec 2023 03:59:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8CAE63857C69 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8CAE63857C69 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701921582; cv=none; b=I7VAs2dsjVIo3P9Rm/crUcgfVZtznBmU+QWgfKx5eCPVPWY5QNdIUPIhggnpYhNv9ALxH7L0od97yEt7mAuiZXrd0+1pGixWmT2wAjJTqXkTV7zi4mGB4m0q5uFV41YvAXRZ+qYq8+oZOd/6dRRbQ0TTydddO2emVMAuvCNkjiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701921582; c=relaxed/simple; bh=BHgjb2biVdOLRusqyfGd56y8q9+yOmvRqLTvN5Q+rII=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=JX/8lszCf5E9LtnDHQqLv97O+b+ajTnxYfSbpw9SkzGWZYrcHQDFUcnX5ShsH27wwO0WKUzb6bJXLovf06tEqTrBG/FxJhqvVRFOylvApvKfe5un3050FQVMTaUrLckejF4OtwedI9oU9L7UWD8aT42iVfaF1/wX94huxPmcWZM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id ED2FF335D6E; Thu, 7 Dec 2023 03:59:40 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH 02/17] sim: bfin: gui: fix -Wunused-but-set-variable warnings Date: Wed, 6 Dec 2023 20:59:22 -0700 Message-ID: <20231207035937.14920-2-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231207035937.14920-1-vapier@gentoo.org> References: <20231207035937.14920-1-vapier@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Rework the code to use static inline functions when it's disabled rather than macros so the compiler knows the various function args are always used. The ifdef macros are a bit ugly, but get the job done without duplicating the function prototypes. --- sim/bfin/gui.h | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/sim/bfin/gui.h b/sim/bfin/gui.h index ef363b599861..daf4398694b4 100644 --- a/sim/bfin/gui.h +++ b/sim/bfin/gui.h @@ -21,7 +21,14 @@ #ifndef BFIN_GUI_H #define BFIN_GUI_H +/* These macros are ugly. */ #ifdef HAVE_SDL +# define _BFIN_GUI_INLINE +# define _BFIN_GUI_STUB(...) ; +#else +# define _BFIN_GUI_INLINE ATTRIBUTE_UNUSED static inline +# define _BFIN_GUI_STUB(val) { return val; } +#endif enum gui_color { GUI_COLOR_RGB_565, @@ -30,21 +37,24 @@ enum gui_color { GUI_COLOR_BGR_888, GUI_COLOR_RGBA_8888, }; -enum gui_color bfin_gui_color (const char *color); -int bfin_gui_color_depth (enum gui_color color); - -void *bfin_gui_setup (void *state, int enabled, int height, int width, - enum gui_color color); +_BFIN_GUI_INLINE +enum gui_color bfin_gui_color (const char *color) + _BFIN_GUI_STUB(GUI_COLOR_RGB_565) -unsigned bfin_gui_update (void *state, const void *source, unsigned nr_bytes); +_BFIN_GUI_INLINE +int bfin_gui_color_depth (enum gui_color color) + _BFIN_GUI_STUB(0) -#else +_BFIN_GUI_INLINE +void *bfin_gui_setup (void *state, int enabled, int height, int width, + enum gui_color color) + _BFIN_GUI_STUB(NULL) -# define bfin_gui_color(...) 0 -# define bfin_gui_color_depth(...) 0 -# define bfin_gui_setup(...) NULL -# define bfin_gui_update(...) 0 +_BFIN_GUI_INLINE +unsigned bfin_gui_update (void *state, const void *source, unsigned nr_bytes) + _BFIN_GUI_STUB(0) -#endif +#undef _BFIN_GUI_INLINE +#undef _BFIN_GUI_STUB #endif