Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to define a macro with value via command line? #22

Open
db4 opened this issue Aug 27, 2015 · 3 comments
Open

How to define a macro with value via command line? #22

db4 opened this issue Aug 27, 2015 · 3 comments

Comments

@db4
Copy link

db4 commented Aug 27, 2015

I must be missing something but cppo -D VAL=1 test.ml doesn't work:

let x = VAL

is expanded into

#1 "test.ml"
let x =  
#1      
        =1
@mjambon
Copy link
Member

mjambon commented Aug 27, 2015

The command line for that is cppo -D 'VAL 1'. If I remember correctly, it was simpler to implement that way so I didn't bother supporting the usual cpp syntax. In hindsight it was a bad decision.

@db4
Copy link
Author

db4 commented Aug 28, 2015

I see. But maybe to support both -D 'VAL 1' and -D VAL=1? It shouldn't be that hard.

And it would be great if the syntax was mentioned in the docs.

@mjambon
Copy link
Member

mjambon commented Aug 28, 2015

I added an example to the command-line help.

I'm hesitant to support the = syntax. Reasons are:

  • supporting two syntaxes for the same thing isn't great
  • it's inconsistent with the syntax used inside files, where no equal sign is used
  • it introduce an incompatibility, e.g. -D 'EQ =' has now a new meaning

None of this is a big deal. Maybe we can support both syntaxes but deprecate the space-based syntax.

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Oct 13, 2020
Try to fix bug 704146, thanks to mgorny for reporting.

The problem appears to be caused by some change in quoting behaviour
of ocamlfind, ocamlc, bash, make or cppo.  The quoting insanity is
caused by cppo requiring defines on the command line to use quoted
spaces, single quotes and double quotes:
ocaml-community/cppo#22

Bug: https://bugs.gentoo.org/show_bug.cgi?id=704146
Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Mark Wright <gienah@gentoo.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants