From patchwork Thu Apr 13 19:44:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Gupta X-Patchwork-Id: 67716 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 AAAB33858408 for ; Thu, 13 Apr 2023 19:45:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AAAB33858408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681415113; bh=mtN0Bi98xYfsFogQHs9pWDBtPnmUWsnnYq+EzKMff38=; h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=A25xiRGUoT+3kkhNVgBXWutJttNyqDrxmLfoNjXWjogwAWN80ZCmfGxcqHA1OYxH0 SyH8eX7SJZaGqSPhAlOJE2wNJ9WxwAc4j6ajSFcPpnGziur8IWTDG3oODL597UwhSx wqnR8gC8LmVzVK4CHle8upztNN8KDYoeACcxp0YQ= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by sourceware.org (Postfix) with ESMTPS id C25AF385840C for ; Thu, 13 Apr 2023 19:44:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C25AF385840C Received: by mail-pg1-x549.google.com with SMTP id l65-20020a639144000000b005091ec4f2d4so6908627pge.20 for ; Thu, 13 Apr 2023 12:44:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681415089; x=1684007089; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mtN0Bi98xYfsFogQHs9pWDBtPnmUWsnnYq+EzKMff38=; b=FFyDSPd3kZ8ly4Gfbcp6xkq9oK6PzWXUWv4uL91Lz8RZdasibkn/S/p3m0cikXxxyO 6xrzUimtUW9J9l3xO7QwXgcsdC2LUWVaEc77MH0BnoMZjRQhbZDC0Vp26+TC1mKAYhIL osWS9jIb5K5CbyT2Pw0H/1msrFqVWxEmH2mx9c1Ic9LJFztC+gCKMdKZNHrTwh/uXnME GXZv3RyJtChMNZQ7gxgNjTXux86dQO1KrVBzF6ix0/dRs+fJL4+7knhBQQJUD+d4LBLL xQ0arjQygQjY4jWmYi8AwF1Cedwg4Ofb+Cub8CRi3ulxXTBy8QZE4rkDoWzDlwqtN5n6 iP7A== X-Gm-Message-State: AAQBX9fOtSLL6xR8/SMmDuQwTYn9lupaFu39aoFKU8HP5fP0RVKabS5c BfouoMWcjzjhFKm+ddGDq01qud3/CAdQiajKKriqKeCEG1Wos/he7IfZrHP5gFwx1qiimy9rYGb l8/CyFzHhKXM4qsd1EaLnjFXhwfYcOK574UEtd1Dwvw9LkAZRa3JtVXVNQ+GjkhUiI5UgbCKHkn O9KA== X-Google-Smtp-Source: AKy350ZeFleLIec9Hg2Tc5UK/T6F6da0lGtKpuIJUXbwy5MfZyAi/k67lYEFAigECV6SZH4wA5t0gqCjKWbUEXnp X-Received: from manojg.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:3eb7]) (user=manojgupta job=sendgmr) by 2002:a17:90a:3fc4:b0:246:d7d1:69ff with SMTP id u4-20020a17090a3fc400b00246d7d169ffmr2697327pjm.1.1681415088756; Thu, 13 Apr 2023 12:44:48 -0700 (PDT) Date: Thu, 13 Apr 2023 12:44:42 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog Message-ID: <20230413194442.3851955-1-manojgupta@google.com> Subject: [PATCH] safe-ctype.h: Fix building with latest libc++ To: gdb-patches@sourceware.org Cc: manojgupta@google.com X-Spam-Status: No, score=-21.2 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Manoj Gupta via Gdb-patches From: Manoj Gupta Reply-To: Manoj Gupta Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Latest libc++[1] causes transitive include to when or header is included. This causes gdb to not build[2] since defines isupper/islower etc. functions that are explicitly macroed-out in safe-ctype.h to prevent their use. Use the suggestion from libc++ to include internally when building in C++ mode to avoid build errors. [1]: https://reviews.llvm.org/D144331 [2]: https://issuetracker.google.com/issues/277967395 --- include/safe-ctype.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/safe-ctype.h b/include/safe-ctype.h index a3cb1858efc..843ba98571c 100644 --- a/include/safe-ctype.h +++ b/include/safe-ctype.h @@ -117,9 +117,16 @@ extern const unsigned char _sch_tolower[256]; detecting that ctype.h has been included. But this was causing trouble as ctype.h might get indirectly included as a result of including another system header (for instance gnulib's stdint.h). - So we include ctype.h here and then immediately redefine its macros. */ + So we include ctype.h here and then immediately redefine its macros. + When compiling in C++ mode, aldo add which also defines + is* functions. +*/ #include +#ifdef __cplusplus +#include +#endif + #undef isalpha #define isalpha(c) do_not_use_isalpha_with_safe_ctype #undef isalnum