[lld] r194624 - Remove default label from fully covered switch.

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Nov 13 22:31:57 PST 2013


On 2013 Nov 13, at 21:41, Rui Ueyama <ruiu at google.com> wrote:

> On Wed, Nov 13, 2013 at 7:21 PM, Duncan Exon Smith <dexonsmith at apple.com> wrote:
> On Nov 13, 2013, at 3:33 PM, Rui Ueyama <ruiu at google.com> wrote:
> 
> >   case NCR_Error:
> >     llvm::errs() << "SymbolTable: error while merging " << name << "\n";
> > -    // FALLTHRU
> > -  default:
> > -    llvm::report_fatal_error("SymbolTable::addByName(): unhandled switch clause");
> >   }
> 
> Was the change in behavior intended, or should you add a new report_fatal_error() call?
> 
> This change is kind of intended. If something wrong in the input, we sometimes terminate the linker immediately, and sometimes continue processing after printing an error with llvm::err(). Previously the linker is terminated with pretty vague error message ("unhandled switch clause"). With this patch it proceed after printing an error. I was OK in either way, so I just removed default label. I should have made this point clear in the commit log. Sorry about that.

NCR_Error specifically indicates that one of the symbols is absolute; interesting that this isn’t worth terminating over.  I see that some duplicate definitions result in termination.  However, as long as new behavior is intentional, you may want to change the llvm::errs printout to “lld warning: ...” and be more explicit than “error while merging”.

Style nit: last case item should probably have a “break;”.



More information about the llvm-commits mailing list