Ted Middleton
Ted Middleton

Reputation: 7274

What's the equivalent of `cpp -dD` for clang?

If I want to find out what implicit preprocessor defines gcc gives me, I can type echo "" | cpp -dD. Does anyone know what the equivalent for clang is?

Upvotes: 33

Views: 14458

Answers (2)

Antonio
Antonio

Reputation: 20286

clang "dumping processor state" options are defined here. The option you are looking for is -dM, so you'll run:

clang -dM -E -

To trigger execution, you then need to terminate the manual input:

  • For Windows: Ctrl-Z Enter
  • For Unix: Ctrl-D

Otherwise, directly execute:

  • For Windows: clang -dM -E - < NUL
  • For Unix: clang -dM -E - < /dev/null

Upvotes: 10

ismail
ismail

Reputation: 47602

clang -dM -E - < /dev/null

will list all the preprocessor definitions for clang.

Upvotes: 64

Related Questions