Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#9213 closed bug (invalid)

Maybe important CPP warnings on ghcautoconf.h

Reported by: asr Owned by:
Priority: normal Milestone: 8.0.1
Component: Compiler Version: 7.10.1-rc2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by asr)

cpphs 1.18.6 yields the following warning:

Warning: trailing characters after #if directive in file ... /ghcautoconf.h  at line 383 col 1:  AC_APPLE_UNIVERSAL_BUILD

I guess it is necessary to replace #if defined by #ifdef in the line

#if defined AC_APPLE_UNIVERSAL_BUILD

from the mk/config.h.in file.

Note the next line

# if defined __BIG_ENDIAN__

has the same issue.

Change History (15)

comment:1 Changed 5 years ago by asr

Description: modified (diff)
Summary: CPP warnings on ghcautoconf.hMaybe important CPP warnings on ghcautoconf.h from cpphs
Version: 7.8.27.8.3

comment:2 Changed 5 years ago by thomie

Status: newinfoneeded

Thank you for the report.

You mention: "cpphs 1.18.5 yields the following warning". Can you supply the steps needed to reproduce this. Do you mean during the building/installation of cpphs, or when you run it some on some inputfile?

comment:3 Changed 5 years ago by asr

You can reproduce the issue by installing Agda (sorry I know this is not a simple package). Note that Agda uses cpphs as the default C preprocessor.

$ cabal install Agda-2.4.2.1
...
Preprocessing library Agda-2.4.2.1...
Warning: trailing characters after #if directive in file /usr/local/stow/ghc-7.8.3-bin/lib/ghc-7.8.3/include/ghcautoconf.h  at line 383 col 1:  AC_APPLE_UNIVERSAL_BUILD
Last edited 5 years ago by asr (previous) (diff)

comment:4 Changed 5 years ago by asr

Version: 7.8.37.8.4-rc1

comment:5 Changed 5 years ago by asr

Description: modified (diff)

comment:6 Changed 5 years ago by asr

Version: 7.8.4-rc17.8.4

comment:7 Changed 5 years ago by asr

A small example using the file https://github.com/simonmar/alex/blob/3.1.4/tests/tokens.x:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.4

$ alex --version
Alex version 3.1.4, (c) 2003 Chris Dornan and Simon Marlow

$ cpphs --version
cpphs 1.18.6

$ alex Tokens.x

$ ghc -pgmP cpphs -optP --cpp Tokens.hs 
Warning: trailing characters after #if directive in file /usr/local/stow/ghc-7.8.4-bin/lib/ghc-7.8.4/include/ghcautoconf.h  at line 383 col 1:  AC_APPLE_UNIVERSAL_BUILD
[1 of 1] Compiling Main             ( Tokens.hs, Tokens.o )
Linking Tokens ...

Last edited 5 years ago by asr (previous) (diff)

comment:8 Changed 5 years ago by asr

Version: 7.8.47.10.1-rc1

And using GHC 7.10.1 RC1, I also got the warning:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.0.20141222

$ ghc -pgmP cpphs -optP --cpp Tokens.hs 
...
Warning: trailing characters after #if directive in file /usr/local/stow/ghc-7.10.0.20141222-bin/lib/ghc-7.10.0.20141222/include/ghcautoconf.h  at line 379 col 1:  AC_APPLE_UNIVERSAL_BUILD
Last edited 5 years ago by asr (previous) (diff)

comment:9 Changed 5 years ago by asr

Status: infoneedednew

comment:10 Changed 5 years ago by asr

Milestone: 7.10.1

comment:11 Changed 5 years ago by asr

A minimal example:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.0.20150123
$ cpphs --version
cpphs 1.18.8
$ cat Main.hs
{-# LANGUAGE CPP #-}

module Main where

-- Used for example by Alex 3.1.4 and GHC source code.
#include "ghcconfig.h"

main :: IO ()
main = putStrLn "Hello, World!"
$ ghc -pgmP cpphs -optP --cpp Main.hs
Warning: trailing characters after #if directive in file /usr/local/stow/ghc-7.10.1.RC2/lib/ghc-7.10.0.20150123/include/ghcautoconf.h  at line 379 col 1:  AC_APPLE_UNIVERSAL_BUILD
Last edited 5 years ago by asr (previous) (diff)

comment:12 Changed 5 years ago by asr

Summary: Maybe important CPP warnings on ghcautoconf.h from cpphsMaybe important CPP warnings on ghcautoconf.h
Version: 7.10.1-rc17.10.1-rc2

comment:13 Changed 5 years ago by thoughtpolice

Milestone: 7.10.17.12.1

Moving to 7.12 for now. FWIW, I can't quite tell if cpphs correctly handles this #if define syntax (which I assume traditional CPP does), meaning maybe upstream should fix it, but I don't think at the moment it's going to break anything severe based on this example.

OTOH, this can probably be mitigated by modifying the rules to generate ghcautoconf.mk, which is actually a copy of some autoconf output created during the build; a sed invocation could probably do it - the rule to generate ghcautoconf is in includes/ghc.mk (search for __GHCAUTOCONF_H__).

comment:14 Changed 5 years ago by asr

Resolution: invalid
Status: newclosed

cpphs 1.18.8 doesn't handle the defined operator, so it isn't a GHC bug. I'll report the issue to cpphs' author.

Last edited 5 years ago by asr (previous) (diff)

comment:15 Changed 4 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

Note: See TracTickets for help on using tickets.