From patchwork Thu Oct 10 10:27:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Pratt X-Patchwork-Id: 98651 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 EFDF13857341 for ; Thu, 10 Oct 2024 10:27:25 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) by sourceware.org (Postfix) with ESMTPS id 80CB0385703B for ; Thu, 10 Oct 2024 10:27:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 80CB0385703B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=pm.me ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 80CB0385703B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=185.70.43.16 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728556032; cv=none; b=pHSS0NsQNapEgoGo/bhbenhnKxKrV3afoR7TypsHNhQ4Lml9/j9SaXJGWC9NFX7kGY+Lf4/lfK+4f7+5LVMnhfMHO3CDO7kfPF49qXWN0xsc69qIkJX9ZjRukwyjD2cfzHtxYH6iPAiJI3PjDUIj2s6BnjArVihpGPW4ju2XPhw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728556032; c=relaxed/simple; bh=gFjPScs3RZ6UE2GV3VPjj+H8rWVP7C5IQ5YOCUklmkc=; h=DKIM-Signature:Date:To:From:Subject:Message-ID:MIME-Version; b=rpJNBWYOpfApjXHqjRfITiuXuatKuI2PwN3oFyMQAIF0h7e6dpWvVP4Dj+aKWxQoXhYm+HhGUjmqM1r7HzFIfv/9a1RVj7J5IWsWSWCrUBm7oXJAk86NN2BEaH12q30qWYzV1owJFEty7QBeoN5uIoobrrjZAzRlnJ8RnAHMgAk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1728556027; x=1728815227; bh=v6lEidwG8QBdOXjO0HwABK3fUPgSrxTsrbLsY5HUiPM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=HkQCq3aPKi0KfcqPwEqNPz3QSREaxlAUFDclsPBzOxf4PGW9MT61JsJLFHeG6pQ9T FkcKe7G+sBjU1WE+kdJB8+oHD3Bk/NTHvSiSCJRGqC2x2of7m/14Lo90cME9i+ouk+ XcR+VGoUxZCuTNhfQ/l7ARYKaQSMN7+wRfOEnRNa2MIeOH7c2YpfTVz10s84yVoaHp PkdJv3Ek8AS6W/EsSqu/YO3TmafAClwfM5suYNfJnYCmlHqu430VqQL6/xXIrpk638 D9/B2UzTJg36KtM+dkErhxVu9xyUCx9VWEafvH7V9iMpvrsacTkHwu56PmNOijN0/y zGfYOFK55b/pQ== Date: Thu, 10 Oct 2024 10:27:02 +0000 To: elfutils-devel@sourceware.org From: Michael Pratt Cc: Michael Pratt Subject: [PATCH 2/6] libcpu: Include config.h before standard headers in lexer source Message-ID: <20241010102559.9162-3-mcpratt@pm.me> In-Reply-To: <20241010102559.9162-1-mcpratt@pm.me> References: <20241010102559.9162-1-mcpratt@pm.me> Feedback-ID: 27397442:user:proton X-Pm-Message-ID: 93f9423e511edd845d608e785562f6c74f09c42a MIME-Version: 1.0 X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, KAM_SHORT, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org As part of the processing of flex, definitions and headers are added to output source before any literal text or generated code. This causes standard headers to come before config.h unless config.h is included in a %top block instead as specified in the flex manual, section 5.1 "Format of the Definitions". The %top block is non-POSIX, so using it reinforces the requirement of "flex" over a standardized "lex" even more. * libcpu/i386_lex.l (%top): add flex %top block and move config.h header inclusion to it. Signed-off-by: Michael Pratt --- libcpu/i386_lex.l | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libcpu/i386_lex.l b/libcpu/i386_lex.l index 9b33ed95..9c1e14db 100644 --- a/libcpu/i386_lex.l +++ b/libcpu/i386_lex.l @@ -1,3 +1,9 @@ +%top{ +#ifdef HAVE_CONFIG_H +# include +#endif +} + %{ /* Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc. Written by Ulrich Drepper , 2004. @@ -26,10 +32,6 @@ the GNU Lesser General Public License along with this program. If not, see . */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include