From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E0E523858426; Wed, 25 Jan 2023 15:24:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0E523858426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674660268; bh=7aKvz1APs3/LYHkResK2eK0vbSSLeHkx8OI81aCKuuk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=soxBR6ubZcnUn9qYg+3qN+A4JPAh4JMB3K5PcXEmTMsgmYxzv6xYJ5CXUOmFC63iq h0i/X58TCZ1lErd0QHTlzPwk8AmR+o0JOSkL6aYkznVpkgvzht4C6o94tg5GM2tbaE z30G0JKnr/caPhF9ajf9bjQN3bA1nJ6CU+xCKETA= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug modula2/102343] gm2/cpp/pass/subaddr.mod FAILs for non-default multilib Date: Wed, 25 Jan 2023 15:24:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: modula2 X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: testsuite-fail X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: iains at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102343 --- Comment #4 from CVS Commits --- The master branch has been updated by Iain D Sandoe : https://gcc.gnu.org/g:80cf2c5e8f496bed9c6facf55f9ae31d0d90fd28 commit r13-5373-g80cf2c5e8f496bed9c6facf55f9ae31d0d90fd28 Author: Iain Sandoe Date: Mon Jan 16 14:07:20 2023 +0000 modula-2: Fixes for preprocessing [PR102343, PR108182]. Modula-2 uses the C preprocessor to implement handling for conditional code and macros. However, this is not done directly, because the proce= ss is applied recursively to imported definitions and modules. The cc1gm2 executable records the parameters as a template command line needed to create a composite 'cc1 -E' for each file to be preprocessed starting with the main file from the original command line. This patch fixes the capture of the C preprocessor template to include the target information needed for correct multilib operation. In order to match the existing semantics of '-E, -M and -MM' these have to be handled as a 'pre-processor only' job (i.e. the recursion is omit= ted and only the main file is processed). Whereas C-family front ends always pre-process, Modula-2 only does so when specifically requested (via the -fcpp option). '-MD, -MMD and -MQ' also require special handling, since (in principle) these options can be applied to any command line (with -fcpp) providing dependency information as a by-product. TODO: the preprocessor is not able to determine def and mod dependencies for Modula-2 and so the output of this only shows the object to module dep. We should be able to append the .def and .mod dependencies. The patch amends save-temps handling to cater for the preprocessor recursion and to avoid writing saved files into the source directories. The patch changes the extension for Modula-2 preprocessed source to .m2i to avoid clashes with .i. The main driver code is amended to add default handlers for .mod and .m= 2i so that a useful error message will be emitted if the Modula-2 compiler is not built-in. The compiler will now also handle code generation from a .m2i preproces= sed source. TODO: We should not need to pass the '-c' option to the compiler to alt= er the processing of init code. Signed-off-by: Iain Sandoe PR modula2/102343 PR modula2/108182 gcc/ChangeLog: * gcc.cc: Provide default specs for Modula-2 so that when the language is not built-in better diagnostics are emitted for attempts to use .mod or .m2i file extensions. gcc/m2/ChangeLog: * gm2-compiler/M2Comp.mod: Early exit for pre-processor-only jo= bs. * gm2-compiler/M2Options.def (SetPPOnly, GetPPOnly, SetMD, GetM= D, SetMMD, GetMMD, SetMQ, GetMQ, SetObj, GetObj, SetDumpDir, GetDumpDir):New. * gm2-compiler/M2Options.mod:(SetPPOnly, GetPPOnly, SetMD, GetM= D, SetMMD, GetMMD, SetMQ, GetMQ, SetObj, GetObj, SetDumpDir, GetDumpDir):New. * gm2-compiler/M2Preprocess.def (PreprocessModule): Add flag to indicate the main file. * gm2-compiler/M2Preprocess.mod: Handle Preprocess-only jobs, handle MD, MMD and MQ options. * gm2-gcc/m2options.h (M2Options_SetPPOnly, M2Options_GetPPOnly, M2Options_SetDumpDir, M2Options_SetMD, M2Options_GetMD, M2Options_SetMMD, M2Options_GetMMD, M2Options_SetMQ, M2Options_GetMQ, M2Options_SetObj, M2Options_GetObj): New. * gm2-gcc/m2type.cc (m2type_InitBaseTypes): Early exit for pre- processor-only jobs. * gm2-lang.cc (gm2_langhook_init): Handle preprocess-only comma= nds. (gm2_langhook_option_lang_mask): Claim C and Driver options so = that we can intercept them for building pre-processor commands. (gm2_langhook_init_options): Collect the preprocessor line here. Save options that have different actions for preprocessor and compile commands. (gm2_langhook_handle_option): Only handle the modula-2 options here. (gm2_langhook_post_options): Do not create a back-end for pre- processor-only jobs. * gm2spec.cc (lang_specific_driver): Ignore PCH options, append= a scaffold-main for cases where we are building a main module with -c. * lang-specs.h: Revise to handle preprocessor-only jobs and to consume pre-processed files. * lang.opt: Remove Driver and C options copies (we claim these separately).=