History log of /src/usr.bin/indent/Makefile |
Revision | | Date | Author | Comments |
1.15 |
| 13-May-2023 |
rillig | indent: move debugging code to separate file
No functional change.
|
1.14 |
| 07-Oct-2021 |
rillig | indent: raise WARNS from the default 5 up to 6
|
1.13 |
| 25-Sep-2021 |
rillig | indent: prepare for lint's strict bool mode
Before C99, C had no boolean type. Instead, indent used int for that, just like many other programs. Even with C99, bool and int can be used interchangeably in many situations, such as querying '!i' or '!ptr' or 'cond == 0'.
Since January 2021, lint provides the strict bool mode, which makes bool a non-arithmetic type that is incompatible with any other type. Having clearly separate types helps in understanding the code.
To migrate indent to strict bool mode, the first step is to apply all changes that keep the resulting binary the same. Since sizeof(bool) is 1 and sizeof(int) is 4, the type ibool serves as an intermediate type. For now it is defined to int, later it will become bool.
The current code compiles cleanly in C99 and C11 mode, as well as in lint's strict bool mode. There are a few tricky places:
In args.c in 'struct pro', there are two types of options: boolean and integer. Boolean options point to a bool variable, integer options point to an int variable. To keep the current structure of the code, the pointer has been changed to 'void *'. To ensure type safety, the definition of the options is done via preprocessor magic, which in C11 mode ensures the correct pointer types. (Add CFLAGS+=-std=gnu11 at the very bottom of the Makefile.)
In indent.c in process_preprocessing, a boolean variable is post-incremented. That variable is only assigned to another variable, and that variable is only used in a boolean context. To provoke a different behavior between the '++' and the '= true', the source code to be indented would need 1 << 32 preprocessing directives, which is unlikely to happen in practice.
In io.c in dump_line, the variables ps.in_stmt and ps.in_decl only ever get the values 0 and 1. For these values, the expressions 'a & ~b' and 'a && !b' are equivalent, in all versions of C. The compiler may generate different code for them, though.
In io.c in parse_indent_comment, the assignment to inhibit_formatting takes place in integer context. If the compiler is smart enough to detect the possible values of on_off, it may generate the same code before and after the change, but that is rather unlikely.
The second step of the migration will be to replace ibool with bool, step by step, just in case there are any hidden gotchas in the code, such as sizeof or pointer casts.
No change to the resulting binary.
|
1.12 |
| 26-Mar-2021 |
rillig | indent: remove workaround for array initialization bug in lint
The bug has been fixed in init.c 1.133 from 2021-03-25.
|
1.11 |
| 14-Mar-2021 |
rillig | indent: fix lint warnings
No functional change.
|
1.10 |
| 12-Mar-2021 |
rillig | indent: add helper functions for doing the actual output
This allows to add debug logging to these few functions instead of all other places that might output something.
Reducing the possible output formats to a few primitives makes dump_line simpler, especially the fprintf calls. It also removes the non-constant printf string.
The call to output_int may be meant for debugging, as the character 0x80 is unlikely to appear in any real-world code.
No functional change.
|
1.9 |
| 08-Mar-2021 |
rillig | indent: make it easy to compile indent in debug mode
|
1.8 |
| 07-Mar-2021 |
rillig | indent: for the token types, use enum instead of #define
This makes it easier to step through the code in a debugger.
No functional change.
|
1.7 |
| 04-Apr-2019 |
kamil | Upgrade indent(1)
Merge all the changes from the recent FreeBSD HEAD snapshot into our local copy.
FreeBSD actively maintains this program in their sources and their repository contains over 100 commits with changes.
Keep the delta between the FreeBSD and NetBSD versions to absolute minimum, mostly RCS Id and compatiblity fixes.
Major chages in this import:
- Added an option -ldi<N> to control indentation of local variable names. - Added option -P for loading user-provided files as profiles - Added -tsn for setting tabsize - Rename -nsac/-sac ("space after cast") to -ncs/-cs - Added option -fbs Enables (disables) splitting the function declaration and opening brace across two lines. - Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1) - Group global option variables into an options structure - Use bsearch() for looking up type keywords. - Don't produce unneeded space character in function declarators - Don't unnecessarily add a blank before a comment ends. - Don't ignore newlines after comments that follow braces.
Merge the FreeBSD intend(1) tests with our ATF framework. All tests pass.
Upgrade prepared by Manikishan Ghantasala. Final polishing by myself.
|
1.6 |
| 08-Oct-2006 |
peter | branches: 1.6.82; WFORMAT is no more...
|
1.5 |
| 11-Oct-2000 |
is | More format string cleanup by sommerfeld.
|
1.4 |
| 18-Oct-1997 |
mrg | branches: 1.4.4; 1.4.12; merge lite-2.
|
1.3 |
| 09-Jan-1997 |
tls | RCS ID police
|
1.2 |
| 31-Jul-1993 |
mycroft | Add RCS indentifiers.
|
1.1 |
| 09-Apr-1993 |
cgd | branches: 1.1.1; added, from net/2 (patch 124).
|
1.1.1.2 |
| 04-Apr-2019 |
kamil | FreeBSD indent r340138
|
1.1.1.1 |
| 06-Jun-1993 |
mrg | 4.4BSD-Lite2
|
1.4.12.1 |
| 18-Oct-2000 |
tv | Pullup usr.bin string format fixes [is]. See "cvs log" for explicit revision numbers per file, from sommerfeld.
|
1.4.4.1 |
| 19-Oct-2000 |
he | Pull up revision 1.5 (requested by he): Format string cleanup.
|
1.6.82.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|