Presumably CFG_CMD_ALL represents a bit vector, and CFG_CMD_NONSTD
one or more of the bits. The OP should have provided this
information (and the value of CFG_CMD_IDE), though.
After expansion, the second line becomes:
#if ((CFG_CMD_ALL & ~CFG_CMD_NONSTD) & CFG_CMD_IDE)
It's complaining about the first &, not the second.
Again, try ! instead.
I strongly suspect that is wrong. The use of bitwise-and (&) rather
than logical-and (&&), and the general form of the expression,
strongly suggest that this expression is meant to test if a
particular bit (or set of bits) is set in the left operand.
But also, how is CFG_CMD_NONSTD defined?
This is indeed the pertinent question. I suspect it's something
like
#define CFG_CMD_NONSTD 2
or
#define CFG_CMD_NONSTD (1<<1)
or perhaps something like
#define CFG_CMD_A 0x01
#define CFG_CMD_B 0x02
/* vector of "nonstandard" commands */
#define CFG_CMD_NONSTD (CFG_CMD_A | CFG_CMD_B)
And the diagnostic that the OP is getting is probably due to using
the binary-negation operator (~) on a signed integer constant, which
will produce a result with the opposite sign. (In two's-complement,
for example, ~1 == -2.)
The simple fix would seem to be changing the definition of
CFG_CMD_NONSTD, or of the other macros that compose it if it's an
expression, to use unsigned integer constants, as in:
#define CFG_CMD_NONSTD 2u
--
Michael Wojcik (e-mail address removed)
Q: What is the derivation and meaning of the name Erwin?
A: It is English from the Anglo-Saxon and means Tariff Act of 1909.
-- Columbus (Ohio) Citizen