X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gold%2Ferrors.h;h=5602a76d85c54ce11a86c59bba6c942e0ead3297;hb=ec506636cc0c56d4229b00d5e439c0610970f84d;hp=545c463bad31568fe1df813b62c9cbf4da1995be;hpb=75f2446ec3c13eca3fe0c7cfdbb232e760d36596;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/errors.h b/gold/errors.h index 545c463bad..5602a76d85 100644 --- a/gold/errors.h +++ b/gold/errors.h @@ -1,6 +1,6 @@ // errors.h -- handle errors for gold -*- C++ -*- -// Copyright 2006, 2007 Free Software Foundation, Inc. +// Copyright (C) 2006-2020 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -24,6 +24,7 @@ #define GOLD_ERRORS_H #include +#include #include "gold-threads.h" @@ -49,6 +50,12 @@ class Errors void fatal(const char* format, va_list) ATTRIBUTE_NORETURN; + // Report a fallback error. After printing the error, this must exit + // with a special status code indicating that fallback to + // --incremental-full is required. + void + fallback(const char* format, va_list) ATTRIBUTE_NORETURN; + // Report an error and continue. void error(const char* format, va_list); @@ -57,6 +64,10 @@ class Errors void warning(const char* format, va_list); + // Print an informational message and continue. + void + info(const char* format, va_list); + // Report an error at a reloc location. template void @@ -71,24 +82,39 @@ class Errors size_t relnum, off_t reloffset, const char* format, va_list); - // Issue an undefined symbol error. SYM is the undefined symbol. - // RELINFO is the general relocation info. RELNUM is the number of - // the reloc, and RELOFFSET is the reloc's offset. - template + // Issue an undefined symbol error. LOCATION is the location of + // the error (typically an object file name or relocation info). + void + undefined_symbol(const Symbol* sym, const std::string& location); + + // Report a debugging message. void - undefined_symbol(const Symbol* sym, - const Relocate_info* relinfo, - size_t relnum, off_t reloffset); + debug(const char* format, ...) ATTRIBUTE_PRINTF_2; // Return the number of errors. int error_count() const { return this->error_count_; } + // Return the number of warnings. + int + warning_count() const + { return this->warning_count_; } + private: Errors(const Errors&); Errors& operator=(const Errors&); + // Initialize the lock. We don't do this in the constructor because + // lock initialization wants to know whether we are using threads or + // not. This returns true if the lock is now initialized. + bool + initialize_lock(); + + // Increment a counter, holding the lock. + void + increment_counter(int*); + // The number of times we report an undefined symbol. static const int max_undefined_error_report = 5; @@ -96,7 +122,9 @@ class Errors const char* program_name_; // This class can be accessed from multiple threads. This lock is // used to control access to the data structures. - Lock lock_; + Lock* lock_; + // Used to initialize the lock_ field exactly once. + Initialize_lock initialize_lock_; // Numbers of errors reported. int error_count_; // Number of warnings reported.