From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4edgGN9QzmoCoQIAWB0awg (envelope-from ) for ; Tue, 13 Oct 2026 11:40:15 -0400 Received: by simark.ca (Postfix, from userid 112) id 5AE8B1E051; Tue, 13 Oct 2026 11:40:15 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E471B1E04E for ; Tue, 13 Oct 2026 11:40:11 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8553B4BA7990 for ; Tue, 13 Oct 2026 15:40:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8553B4BA7990 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id DABBD4BA7980 for ; Tue, 13 Oct 2026 15:39:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DABBD4BA7980 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DABBD4BA7980 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791905954; cv=none; b=lGaxCY/63kIBF1VEe3Ky3y0vYhnXKYm1tYzl9cybL59hRN1QddL5UWhCAYFo1VQTTcFNSuXn5cl9zReyPtpUDTRCkYxX8JxOc+twBpqlhoNCzLgHClgd4uOpN+AMxWCAC1RNaTMi4ChpUSUGNtO+SKeHT+OYG8nVcxtk4LRTkBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791905954; c=relaxed/simple; bh=MdP1+GstQ9LBFpfLnhMKznaKkwlvD50WUEdS2c0nUI8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Jhohn4DsrM8c/FkbmczpKL84sb+3tWk4LfnuEUcRtCSo8vp6LX8aSRu7lt/1lu7UzzYhtnL5tkBmkLr9tqhxIaSCQNfIdNe8lR7fCk+1bTRsrVyQ1gWjLs+ESteeXyUOUJXw/GvXpFUdWzmRO/NP1yNYAWsN/SOKQKXA/6vqDfg= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DABBD4BA7980 Received: by simark.ca (Postfix) id B3E371E0BC; Tue, 13 Oct 2026 11:39:11 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 15/16] gdb: remove redundant snprintf declaration check Date: Tue, 13 Oct 2026 11:36:01 -0400 Message-ID: <20261013153657.1610298-16-simon.marchi@efficios.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013153657.1610298-1-simon.marchi@efficios.com> References: <20261013153657.1610298-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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~public-inbox=simark.ca@sourceware.org configure.ac checks for the snprintf declaration, but libiberty_INIT already does it. Remove the check from configure.ac. The only user of HAVE_DECL_SNPRINTF in GDB is a check in python-internal.h, which defines HAVE_SNPRINTF on Windows, to prevent older Python headers from redefining snprintf to _snprintf. It uses "defined (HAVE_DECL_SNPRINTF)", which is always true, since AC_CHECK_DECLS defines HAVE_DECL_SNPRINTF to either 0 or 1. Since it apparently worked fine like this for a while, simplify the condition to just check _WIN32. snprintf is standard in C++11 anyway. I checked whether defining HAVE_SNPRINTF is still needed at all. It is no longer necessary since CPython commit e822e37946f2 ("bpo-36020: Remove snprintf macro in pyerrors.h (GH-20889)", 2020-06-15), which is available since Python 3.9. So once we drop support for Python 3.8 and below, this can go. Add a note in the source about that. Regenerate configure. Change-Id: I431ccdf7d67a673c8a01ba4f34378a040a4c7bc6 --- gdb/configure | 11 ----------- gdb/configure.ac | 1 - gdb/python/python-internal.h | 7 +++++-- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/gdb/configure b/gdb/configure index 5290d29efbce..cfe994c3842a 100755 --- a/gdb/configure +++ b/gdb/configure @@ -29426,17 +29426,6 @@ _ACEOF -ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default" -if test "x$ac_cv_have_decl_snprintf" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SNPRINTF $ac_have_decl -_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LC_MESSAGES" >&5 $as_echo_n "checking for LC_MESSAGES... " >&6; } diff --git a/gdb/configure.ac b/gdb/configure.ac index b1e0a82b9b07..d10b20f5a17d 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1488,7 +1488,6 @@ AC_CHECK_HEADERS([execinfo.h]) libiberty_INIT -AC_CHECK_DECLS([snprintf]) AM_LC_MESSAGES # ------------------ # diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 5f023b0d9719..5af06d02a51a 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -39,8 +39,11 @@ around technique as above. */ #undef _FILE_OFFSET_BITS -/* A kludge to avoid redefinition of snprintf on Windows by pyerrors.h. */ -#if defined(_WIN32) && defined(HAVE_DECL_SNPRINTF) +/* A kludge to avoid redefinition of snprintf on Windows by pyerrors.h. + + This is only needed for Python <= 3.8, so it can go once support for those + Python versions is dropped. */ +#ifdef _WIN32 #define HAVE_SNPRINTF 1 #endif -- 2.56.0