Commit 3ff8ebb
committed
Let IncludesFinderWithRegExp return at most 1 include
Originally, this code was written to find all include statements in a
source file, for further processing. However, since a while the
include finding was changed to run the preprocessor to see if any
includes are missing, and this class is used to find the missing
includes in the error message.
In practice, the preprocessor will bail out at the first missing
include, since there is no meaningful way for it to continue. This means
there will be at most one include in the error output. If there
would be multiple includes (either because the preprocessor decided to
continue, or there is some other output that accidentially matches the
regex), it would be harmful to actually process all of them, since the
absence of the first include might influence the presence of the second
(e.g. in the presence of #ifdefs).
This commit enforces that only one include is returned at a time,
slightly simplifying the code in the process. The filename and class
should be renamed to singular as well, but this will be left for a
future commit to reduce noise.
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>1 parent 33a565a commit 3ff8ebb
File tree
3 files changed
+11
-15
lines changed- src/arduino.cc/builder
- types
3 files changed
+11
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | 130 | | |
132 | 131 | | |
133 | 132 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
52 | 53 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
58 | 57 | | |
59 | 58 | | |
60 | | - | |
61 | | - | |
62 | 59 | | |
63 | 60 | | |
64 | 61 | | |
65 | | - | |
| 62 | + | |
66 | 63 | | |
67 | 64 | | |
68 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
0 commit comments