summaryrefslogtreecommitdiff
path: root/README-hacking.md
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-04-25 12:10:30 +0200
committerAkim Demaille <akim.demaille@gmail.com>2020-04-25 12:16:57 +0200
commitb74fc07d21ba81954ea30fd87a1ae8bd324cb182 (patch)
tree2773107de8513012a64e859db1720e518ef365da /README-hacking.md
parent3ab12c1036812ef855385c947598284241f746b1 (diff)
downloadbison-b74fc07d21ba81954ea30fd87a1ae8bd324cb182.tar.gz
style: c: fix a few minor issues about indentation of cpp directives
* README-hacking.md: More about cpp. * data/skeletons/c.m4, data/skeletons/yacc.c: Style changes.
Diffstat (limited to 'README-hacking.md')
-rw-r--r--README-hacking.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/README-hacking.md b/README-hacking.md
index 0914cb1f..5e64f95b 100644
--- a/README-hacking.md
+++ b/README-hacking.md
@@ -57,6 +57,31 @@ Actually, Bison has legacy code that we should replace with gnulib modules
### Skeletons
We try to use the "typical" coding style for each language.
+#### CPP
+We indent the CPP directives this way:
+
+```
+#if FOO
+# if BAR
+# define BAZ
+# endif
+#endif
+```
+
+Don't indent with leading spaces in the skeletons (it's ok in the grammar
+files though, e.g., in `%code {...}` blocks).
+
+On occasions, use `cppi -c` to see where we stand. We don't aim at full
+correctness: depending `-d`, some bits can be in the *.c file, or the *.h
+file within the double-inclusion cpp-guards. In that case, favor the case
+of the *.h file, but don't waste time on this.
+
+Don't hesitate to leave a comment on the `#endif` (e.g., `#endif /* FOO
+*/`), especially for long blocks.
+
+There is no conistency on `! defined` vs. `!defined`. The day gnulib
+decides, we'll follow them.
+
#### C/C++
Follow the GNU Coding Standards.