From owner-freebsd-current@freebsd.org Sat May 20 20:12:09 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEFE1D76D17; Sat, 20 May 2017 20:12:09 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 95E981D87; Sat, 20 May 2017 20:12:09 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id v4KKC8kB033111 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 20 May 2017 13:12:08 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id v4KKC8Q9033110; Sat, 20 May 2017 13:12:08 -0700 (PDT) (envelope-from sgk) Date: Sat, 20 May 2017 13:12:08 -0700 From: Steve Kargl To: Ian Lepore Cc: freebsd-current@freebsd.org, freebsd-toolchain@freebsd.org Subject: Re: cpp behavior? Message-ID: <20170520201208.GA33085@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <20170520000747.GA26861@troutmask.apl.washington.edu> <1495301954.89384.39.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1495301954.89384.39.camel@freebsd.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 May 2017 20:12:09 -0000 On Sat, May 20, 2017 at 11:39:14AM -0600, Ian Lepore wrote: > On Fri, 2017-05-19 at 17:07 -0700, Steve Kargl wrote: > > % which cpp > > /usr/bin/cpp > > troutmask:kargl[408] cpp --version > > FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on > > LLVM 4.0.0) > > Target: x86_64-unknown-freebsd12.0 > > Thread model: posix > > InstalledDir: /usr/bin > > troutmask:kargl[409] cpp --help |grep trad > >   -traditional-cpp        Enable some traditional CPP emulation > > troutmask:kargl[410] cpp -traditional-cpp boxmuller.F90  > > cpp: error: unable to execute command: Executable "gcc" doesn't > > exist! > > > > OK, so what is the preprocessor for clang? > > > > It looks like the problem is that it sees the .F90 and wants to "do the > right thing" for fortran sources, which is "invoke gcc".  I got a clue > by adding '-###' (quotes required) to see what cpp was trying to do > internally. Thanks. I did not know about the -### option. > You might get the effect you want by either adding something like -x > assembler-with-cpp, or maybe by hiding the filetype from cpp: I'm checking out the new devel/flang port (a Fortran front-end for clang). Although flang recognizes the .F90 extension, 'flang -c boxmuller.F90' dies a horrible death because it assumes a modern cpp syntax. AFAIK, the traditional syntax that gcc uses with the -traditional-cpp option is required by those who use C preprocessing directives in their Fortran. Modern cpp can corrupt valid Fortran. Having clang invoke gcc when I tried cpp caught me off guard. -- Steve 20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4 20161221 https://www.youtube.com/watch?v=IbCHE-hONow