[PATCH] D35945: [ELF] - Linkerscript: better diagnostic for INPUT/GROUP commands.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 05:23:37 PDT 2017


grimar added inline comments.


================
Comment at: ELF/ScriptParser.cpp:312
   expect("(");
-  while (!Error && !consume(")")) {
-    if (consume("AS_NEEDED"))
+  while (!Error && !consume(")") && !ErrorCount) {
+    if (consume("AS_NEEDED")) {
----------------
grimar wrote:
> grimar wrote:
> > ruiu wrote:
> > > grimar wrote:
> > > > ruiu wrote:
> > > > > Ditto
> > > > Why ? I think readAsNeeded() can set Error.
> > > Whenever error is true, ErrorCount should be greater than 0.
> > I do not think so. What if we will have:
> > 
> > `AS_NEEDED#valid_file_name)`
> > 
> > 'readAsNeeded()' expects '(', but see `#` and triggers Error, then adds file correctly and we have `Error` set, but `ErrorCount` == 0.
> > So looks `readGroup()` is fine.
> > 
> > Honestly I think watching these flags separatelly starting to be complicated. May be better to leave initial version, where both 'Error' and 'ErrorCount' were checked in `readAsNeeded()` ? There is no need to perform attemp to open file in case I showed above.
> Ah, I missed that setError also calls error() which sets ErrorCount to be > 0. Please ignore this comment.
I suggest to switch to always use ErrorCount: D36266


https://reviews.llvm.org/D35945





More information about the llvm-commits mailing list