2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 22:35:35 +00:00

This patch adds a couple of additional lineno reporting testcases:

* a non-include related syntax error (errors/modefail.sd)
  * multiple successful includes followed by a failed include
    (errors/multi_include.sd)

It also fixes two issues with the parser's line counting:

  * the count began at 0 (demonstrated by the first testcase's error
    being reporting on one line less than it should be), and

  * an extra line increment when includes were detected (demonstrated
    by the second testcase's error being reported at a line beyond the
    correct linenumber.

The existing testcases did not catch these because they were all
based on the first include in the file failing and so the start of
the count from 0 counteracted the extra counted line.
This commit is contained in:
Steve Beattie
2010-06-25 12:43:48 -07:00
parent d744377f4a
commit 2d2897f426
5 changed files with 26 additions and 3 deletions

View File

@@ -49,7 +49,7 @@
#endif
#define NPDEBUG(fmt, args...) /* Do nothing */
int current_lineno = 0;
int current_lineno = 1;
char *current_filename = NULL;
struct ignored_suffix_t {
@@ -427,7 +427,6 @@ LT_EQUAL <=
#include/.*\r?\n { /* include */
PDEBUG("Matched #include\n");
current_lineno++;
BEGIN(INCLUDE);
}