[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/11] Automatically include 'size_t', 'wchar_t' and 'ptrdiff_t'
From: |
Tim Hentenaar |
Subject: |
[PATCH 06/11] Automatically include 'size_t', 'wchar_t' and 'ptrdiff_t' as a rw_decl tokens, since they're guaranteed to be available in ANSI C. |
Date: |
Mon, 15 Jun 2015 21:52:57 +0200 |
---
ChangeLog | 2 ++
src/indent.c | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index f5ad166..1f797ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
* Add an option (-slc/--single-line-conditionals) to allow
conditionals and their inner statement to be on the same line if
they're not braced. This should fix GNU bug #42357.
+ * Added a small patch to add size_t, wchar_t and ptrdiff_t to
+ user_specials automatically.
2014-04-07 Andrew Shadura <address@hidden>
* Don't add extra 'const' keyword to C++ programs (closes Debian bugs
diff --git a/src/indent.c b/src/indent.c
index 8e49264..087b3ce 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1040,6 +1040,7 @@ int main(
int argc,
char ** argv)
{
+ char *tmp;
char *profile_pathname = 0;
BOOLEAN using_stdin = false;
exit_values_ty exit_status;
@@ -1065,6 +1066,21 @@ int main(
}
#endif
+ /* 'size_t', 'wchar_t' and 'ptrdiff_t' are guarenteed to be
+ * available in ANSI C.
+ *
+ * I'm malloc'ing this in the hopes that it will be freed
+ * along with the rest of the user_specials array in
+ * lexi.c (assuming that it actually is.)
+ */
+ tmp = (char *)xmalloc(25);
+ memcpy(tmp, "size_t", 7);
+ addkey(tmp, rw_decl);
+ memcpy(tmp + 7, "wchar_t", 8);
+ addkey(tmp + 7, rw_decl);
+ memcpy(tmp + 15, "ptrdiff_t", 10);
+ addkey(tmp + 15, rw_decl);
+
init_parser ();
initialize_backups ();
exit_status = total_success;
--
2.3.6
- [PATCH 00/11] Bugfixes and a few new options, Tim Hentenaar, 2015/06/15
- [PATCH 06/11] Automatically include 'size_t', 'wchar_t' and 'ptrdiff_t' as a rw_decl tokens, since they're guaranteed to be available in ANSI C.,
Tim Hentenaar <=
- [PATCH 04/11] parse: Write out token names when dumping the parser's stack, Tim Hentenaar, 2015/06/15
- [PATCH 01/11] lexi.c: Fix conditionals around the GNU inline attribute, Tim Hentenaar, 2015/06/15
- [PATCH 02/11] Fix html doc generation, Tim Hentenaar, 2015/06/15
- [PATCH 03/11] Fix regression introduced in hg revision 25c27d429590, Tim Hentenaar, 2015/06/15
- [PATCH 09/11] Fix handling of block comments after braces, Tim Hentenaar, 2015/06/15
- [PATCH 07/11] Add an option to use spaces for aligment when using tabs, Tim Hentenaar, 2015/06/15
- [PATCH 08/11] Adjust -npcs so that if set, no space will be added between a function pointer's name and its argument list., Tim Hentenaar, 2015/06/15
- [PATCH 05/11] Add an option to allow single-line conditionals, Tim Hentenaar, 2015/06/15
- [PATCH 11/11] Fix formatting of struct initializer lists, and add -sar, Tim Hentenaar, 2015/06/15