开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Compiler Effusively Complains about `Invalid PP Token`


 

For example - for the lines of code , I get:
?
```
2 warnings generated.
In file included from 34979.c:1:
./bs//Serializer.bs:13:22: warning: missing terminating ' character [-Winvalid-pp-token]
? ? ? ? START ? ?-> 1'b0
? ? ? ? ? ? ? ? ? ? ?^
./bs//Serializer.bs:15:22: warning: missing terminating ' character [-Winvalid-pp-token]
? ? ? ? _ ? ? ? ?-> 1'b1
```
?
I know I can simply disable the pre-processor warns, but why is it so verbose in the first place?


 

Actually - I think the issue here is the the default C preprocessor on MacOS is not great...


 

Yes, when you give the flag -cpp to BSC, it calls the C compiler to preprocess the file.? The message you're seeing is from the C compiler, not BSC.

I don't know why the C compiler would be complaining.? But note that BSC natively supports the SV preprocessor syntax, which you could use instead.? Assuming you even need a preprocessor.? I notice you have this line:

#define UIntLog2N(n) (UInt (TLog n))


That can declared within BSC's type system:

type UIntLog2N n = UInt (TLog n)


J


On Wed, Mar 26, 2025 at 12:48?AM Yehowshua Immanuel via <programmed4jesus=[email protected]> wrote:
Actually - I think the issue here is the the default C preprocessor on MacOS is not great...


 

Sorry, I just realized my mistake, that the SV preprocessor is not available in BH -- sorry :) ?But it's still the case that you can express that define in the type system.

J


On Wed, Mar 26, 2025 at 8:21?AM Julie Schwartz via <quark=[email protected]> wrote:
Yes, when you give the flag -cpp to BSC, it calls the C compiler to preprocess the file.? The message you're seeing is from the C compiler, not BSC.

I don't know why the C compiler would be complaining.? But note that BSC natively supports the SV preprocessor syntax, which you could use instead.? Assuming you even need a preprocessor.? I notice you have this line:

#define UIntLog2N(n) (UInt (TLog n))


That can declared within BSC's type system:

type UIntLog2N n = UInt (TLog n)


J

?