From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.schemamania.org (rrcs-50-75-19-234.nys.biz.rr.com [50.75.19.234]) by sourceware.org (Postfix) with ESMTP id 864ED3858D20 for ; Fri, 2 Dec 2022 18:59:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 864ED3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=schemamania.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=schemamania.org Received: from oak.schemamania.org (localhost [IPv6:::1]) by mail.schemamania.org (Postfix) with ESMTP id 043FA256FAFE; Fri, 2 Dec 2022 13:27:57 -0500 (EST) Date: Fri, 2 Dec 2022 13:27:56 -0500 From: "James K. Lowden" To: Michael Matz Cc: gcc@gcc.gnu.org Subject: Re: access to include path in front end Message-Id: <20221202132756.49d8dff47218676c0f43eff5@schemamania.org> In-Reply-To: References: <20221129100804.c5b3e5bc669ff92f2100c3a3@schemamania.org> <20221201111126.3c0789057cdd420d930836a0@schemamania.org> X-Mailer: Sylpheed 3.4.3 (GTK+ 2.24.28; x86_64--netbsd) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,NICE_REPLY_A,PDS_RDNS_DYNAMIC_FP,RDNS_DYNAMIC,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, 1 Dec 2022 17:14:31 +0000 (UTC) Michael Matz wrote: > > 3. Correct the entries in the default_compilers array. Currently I > > have in cobol/lang-specs.h: > > > > {".cob", "@cobol", 0, 0, 0}, > > {".COB", "@cobol", 0, 0, 0}, > > {".cbl", "@cobol", 0, 0, 0}, > > {".CBL", "@cobol", 0, 0, 0}, > > {"@cobol", > > "cobol1 %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}", > > 0, 0, 0}, > > It misses %(cpp_unique_options) which was the reason why your -I > arguments weren't passed to cobol1. If I understood you correctly, I don't need to modify gcc.cc. I only need to modify cobol/lang-specs.h, which I've done. But that's evidently not all I need to do, because it doesn't seem to work. The last element in the fragment in cobol/lang-specs.h is now: {"@cobol", "cobol1 %i %(cc1_options) %{!fsyntax-only:%(invoke_as)} " "%(cpp_unique_options) ", 0, 0, 0}, (using string constant concatenation). That's the only change I made, so far, because everything we said (AIUI) boiled down to, "just add cpp_unique_options to your spec string". > You would just your new %(cobol_options), or simply '%{v} %{I*}' > directly in addition to cc1_options. I didn't do that. IIUC, the 2nd element in the struct can be a string constant or the address of a char* variable. So, I chose a string constant. Getting wiser with age, I used -### to dump the cobol1 command line. It appears to be consistent with observed behavior: when I run under gdb and stop at the cobol1::main function, argc is 14, and argv does not include the -I option. The -### output reports the cobol1 command line (as 14 strings, exactly) on line 10. In additon to what was supplied (by me, invoking gcobol), it shows: -quiet -dumpdir o- -dumpbase csytst10.cbl -dumpbase-ext .cbl "-main=gcc/cobol/prim/samples/CUBES/cobol/csytst10.cbl" "-mtune=generic" "-march=x86-64" -o /tmp/ccLYrc6D.s The -main I can explain later if it matters. The others are magic I don't understand and don't think matter, but I show them so you know. Note that I'm invoking gcobol from the build tree, using -B (among others) to make it DTRT. I see the -B and -I options, and others, with their arguments, contained in COLLECT_GCC_OPTIONS on lines 9 and 11. I guess that represents an environment string? Or, anyway, a string that holds the options that will be passed to collect2? The contents of COLLECT_GCC_OPTIONS appear to be a superset of the options supplied on the cobol1 command line. It would seem the single change I made is less than the minimum required, but I confess I've lost track of why anything more is needed. --jkl