freebsd-dev/usr.bin/indent/tests/binary.0
Piotr Pawel Stefaniak bd2969a00d indent(1): Support binary integer literals.
This was done by Romain Tartière for PR123553. I initially thought that it would break code like this:
#define b00101010 -1
if (0 b00101010)
...

by joining 0 and b00101010 together. However, the real problem with that patch was that once it saw a 0, it assumed that the number was base 2, 8 or 16, ignoring base 10 floating point numbers. I fixed that.

I didn't copy the diagnostic part of the original patch as it seems out of scope of implementing binary integer literals formatting.

PR:		123553
Submitted by:	romain (original version)
Approved by:	pfg (mentor)
2017-05-18 17:15:58 +00:00

11 lines
224 B
Plaintext

/* $FreeBSD$ */
#define b00101010 -1
void t(void) {
unsigned a[] = {0b00101010, 0x00005678, 02, 17U};
float x[] = {.7f, 0.7f};
unsigned long ul[] = {0b00001111UL, 0x01010101UL, 02UL, 17UL};
if (0 b00101010)
return;
}