From 8ad0c3500a629f40b48c9bc3ecad6859d4d6fe14 Mon Sep 17 00:00:00 2001 From: Piotr Kubowicz Date: Wed, 17 Jun 2020 22:26:44 +0200 Subject: [PATCH] Fix compilation on GCC 4.x TeX Live supports compiling on GCC 4.5, which does not enable C99 features (introduced in 2a2057b5) when run with default settings. This commit returns to pre-C99 syntax and adds instructions how to simulate an old compiler locally. Closes #65 --- ChangeLog | 2 ++ README-development.md | 5 +++++ detex.l | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 58c52d5..e12d40e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -204,3 +204,5 @@ Handle forcing placement with ! (#62). Thanks to schrc3b6. Added option to print source information with -1 (#64). Thanks to Victor Cacciari Miraldo. (Version 2.8.8) -- UNRELEASED + +Fixed compilation on old compilers supported by TeX Live (#65). Thanks to Akira Kakuto and Hironobu Yamashita. diff --git a/README-development.md b/README-development.md index 888da5e..2ef6754 100644 --- a/README-development.md +++ b/README-development.md @@ -19,6 +19,11 @@ It is recommended that you install Valgrind and run tests using it (as it is don ./test.pl --valgrind ``` +Also recommended: check if compilation is not broken on oldest compilers supported by Tex Live (again, if you don't do this, it will be checked on CI): +``` +make clean all DEFS='-std=iso9899:199409' +``` + After pushing check cross-platform compilation results on commits list on GitHub or directly on [Travis CI](https://travis-ci.org/pkubowicz/opendetex). ## Releasing a new version diff --git a/detex.l b/detex.l index 8273afe..02f6db8 100644 --- a/detex.l +++ b/detex.l @@ -732,7 +732,8 @@ Echo() void IncrLineNo() { - for (char* c=yytext; *c != '\0'; c++) { + char *c; + for (c=yytext; *c != '\0'; c++) { if (*c == '\n') { fFileLines[csb]++; fIsColumn0=1; }