From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +Px3EOgW7mShqg0AWB0awg (envelope-from ) for ; Tue, 29 Aug 2023 12:03:52 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=t7IS0JfT; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3FF471E0C2; Tue, 29 Aug 2023 12:03:52 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 3293C1E092 for ; Tue, 29 Aug 2023 12:03:50 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B50E03856DE6 for ; Tue, 29 Aug 2023 16:03:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B50E03856DE6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693325029; bh=3nEhshZzUKXEfjLA7EDxG0Iz0GrKrwJ2/uDtOx/BTP8=; h=Date:To:Cc:Subject:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=t7IS0JfTUmVADkIDcG9lQBhPb2FZ3GNC9/KfytPW0Sy2C+QJOVtzxrawyPgItFc9/ bnb+pcz0M9iiq2MigJICufUwPYou8YJgosEcMR21hg0S12sfXUMupe8TMTpejuG250 Pwht2YWZnnF3Fz7Mp2lbTq9G9XSN0EzeT3gaxeXc= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 2E0D73858431 for ; Tue, 29 Aug 2023 16:03:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2E0D73858431 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-193-erAU1HW7M_eIUDd-2IiVXg-1; Tue, 29 Aug 2023 12:03:27 -0400 X-MC-Unique: erAU1HW7M_eIUDd-2IiVXg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B7CB857A84; Tue, 29 Aug 2023 16:03:26 +0000 (UTC) Received: from f37-zws-nv (unknown [10.22.16.35]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58A0463F6C; Tue, 29 Aug 2023 16:03:26 +0000 (UTC) Date: Tue, 29 Aug 2023 09:03:25 -0700 To: Tom de Vries via Gdb-patches Cc: Tom de Vries Subject: Re: [PATCH] [gdb/build] Fix C inclusion of nat/x86-cpuid.h Message-ID: <20230829090325.3173bf72@f37-zws-nv> In-Reply-To: <20230829153857.12895-1-tdevries@suse.de> References: <20230829153857.12895-1-tdevries@suse.de> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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: , From: Kevin Buettner via Gdb-patches Reply-To: Kevin Buettner Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On Tue, 29 Aug 2023 17:38:57 +0200 Tom de Vries via Gdb-patches wrote: > When running test-case gdb.arch/i386-avx512.exp, I run into: > ... > gdb compile failed, In file included from gdb.arch/i386-avx512.c:20:0: > src/gdb/nat/x86-cpuid.h: In function 'x86_cpuid_count': > src/gdb/nat/x86-cpuid.h:63:16: error: \ > 'nullptr' undeclared (first use in this function) > if (__eax == nullptr) > ^~~~~~~ > src/gdb/nat/x86-cpuid.h:63:16: note: each \ > undeclared identifier is reported only once for each function it appears in [...] > This is due to commit e85aad4ae76 ("nat/x86-cpuid.h: Add x86_cpuid_count > wrapper around __get_cpuid_count"), which introduced the nullptr check. > > The header file gdb/nat/x86-cpuid.h is a file that is included in the build > and compiled as a C++ file, but also in the testsuite and compiled as a C > file. > > Fix this by replacing nullptr with (void *)0. [...] > - if (__eax == nullptr) > + if (__eax == (void *)0) > __eax = &__scratch; > - if (__ebx == nullptr) > + if (__ebx == (void *)0) > __ebx = &__scratch; > - if (__ecx == nullptr) > + if (__ecx == (void *)0) > __ecx = &__scratch; > - if (__edx == nullptr) > + if (__edx == (void *)0) > __edx = &__scratch; Maybe leave nullptr in place and instead do something like this... /* This header file is also used in C code for the gdb.arch/i386-avx512.exp test, so define nullptr to avoid a compile error during testing. */ #ifndef __cplusplus #define nullptr (void *) 0) #endif Kevin