Add Spanish translation to gold.
[binutils-gdb.git] / gold / errors.cc
index e352dc49147740e54c4a860b14f2e0c60ad91f18..d45d6a58b6153f963b90bc4cae89b3f21c4d9da8 100644 (file)
@@ -80,7 +80,7 @@ Errors::increment_counter(int *counter)
 void
 Errors::fatal(const char* format, va_list args)
 {
-  fprintf(stderr, "%s: ", this->program_name_);
+  fprintf(stderr, _("%s: fatal error: "), this->program_name_);
   vfprintf(stderr, format, args);
   fputc('\n', stderr);
   gold_exit(false);
@@ -91,7 +91,7 @@ Errors::fatal(const char* format, va_list args)
 void
 Errors::error(const char* format, va_list args)
 {
-  fprintf(stderr, "%s: ", this->program_name_);
+  fprintf(stderr, _("%s: error: "), this->program_name_);
   vfprintf(stderr, format, args);
   fputc('\n', stderr);
 
@@ -110,6 +110,15 @@ Errors::warning(const char* format, va_list args)
   this->increment_counter(&this->warning_count_);
 }
 
+// Print an informational message.
+
+void
+Errors::info(const char* format, va_list args)
+{
+  vfprintf(stderr, format, args);
+  fputc('\n', stderr);
+}
+
 // Report an error at a reloc location.
 
 template<int size, bool big_endian>
@@ -118,7 +127,7 @@ Errors::error_at_location(const Relocate_info<size, big_endian>* relinfo,
                          size_t relnum, off_t reloffset,
                          const char* format, va_list args)
 {
-  fprintf(stderr, "%s: %s: ", this->program_name_,
+  fprintf(stderr, _("%s: %s: error: "), this->program_name_,
          relinfo->location(relnum, reloffset).c_str());
   vfprintf(stderr, format, args);
   fputc('\n', stderr);
@@ -142,13 +151,10 @@ Errors::warning_at_location(const Relocate_info<size, big_endian>* relinfo,
   this->increment_counter(&this->warning_count_);
 }
 
-// Issue an undefined symbol error.
+// Issue an undefined symbol error with a caller-supplied location string.
 
-template<int size, bool big_endian>
 void
-Errors::undefined_symbol(const Symbol* sym,
-                        const Relocate_info<size, big_endian>* relinfo,
-                        size_t relnum, off_t reloffset)
+Errors::undefined_symbol(const Symbol* sym, const std::string& location)
 {
   bool initialized = this->initialize_lock();
   gold_assert(initialized);
@@ -158,9 +164,16 @@ Errors::undefined_symbol(const Symbol* sym,
       return;
     ++this->error_count_;
   }
-  fprintf(stderr, _("%s: %s: undefined reference to '%s'\n"),
-         this->program_name_, relinfo->location(relnum, reloffset).c_str(),
-         sym->demangled_name().c_str());
+  const char* const version = sym->version();
+  if (version == NULL)
+    fprintf(stderr, _("%s: %s: error: undefined reference to '%s'\n"),
+           this->program_name_, location.c_str(),
+           sym->demangled_name().c_str());
+  else
+    fprintf(stderr,
+            _("%s: %s: error: undefined reference to '%s', version '%s'\n"),
+           this->program_name_, location.c_str(),
+           sym->demangled_name().c_str(), version);
 }
 
 // Issue a debugging message.
@@ -213,6 +226,17 @@ gold_warning(const char* format, ...)
   va_end(args);
 }
 
+// Print an informational message.
+
+void
+gold_info(const char* format, ...)
+{
+  va_list args;
+  va_start(args, format);
+  parameters->errors()->info(format, args);
+  va_end(args);
+}
+
 // Report an error at a location.
 
 template<int size, bool big_endian>
@@ -245,13 +269,22 @@ gold_warning_at_location(const Relocate_info<size, big_endian>* relinfo,
 
 // Report an undefined symbol.
 
+void
+gold_undefined_symbol(const Symbol* sym)
+{
+  parameters->errors()->undefined_symbol(sym, sym->object()->name().c_str());
+}
+
+// Report an undefined symbol at a reloc location
+
 template<int size, bool big_endian>
 void
-gold_undefined_symbol(const Symbol* sym,
+gold_undefined_symbol_at_location(const Symbol* sym,
                      const Relocate_info<size, big_endian>* relinfo,
                      size_t relnum, off_t reloffset)
 {
-  parameters->errors()->undefined_symbol(sym, relinfo, relnum, reloffset);
+  parameters->errors()->undefined_symbol(sym,
+                                         relinfo->location(relnum, reloffset));
 }
 
 #ifdef HAVE_TARGET_32_LITTLE
@@ -321,33 +354,37 @@ gold_warning_at_location<64, true>(const Relocate_info<64, true>* relinfo,
 #ifdef HAVE_TARGET_32_LITTLE
 template
 void
-gold_undefined_symbol<32, false>(const Symbol* sym,
-                                const Relocate_info<32, false>* relinfo,
-                                size_t relnum, off_t reloffset);
+gold_undefined_symbol_at_location<32, false>(
+    const Symbol* sym,
+    const Relocate_info<32, false>* relinfo,
+    size_t relnum, off_t reloffset);
 #endif
 
 #ifdef HAVE_TARGET_32_BIG
 template
 void
-gold_undefined_symbol<32, true>(const Symbol* sym,
-                               const Relocate_info<32, true>* relinfo,
-                               size_t relnum, off_t reloffset);
+gold_undefined_symbol_at_location<32, true>(
+    const Symbol* sym,
+    const Relocate_info<32, true>* relinfo,
+    size_t relnum, off_t reloffset);
 #endif
 
 #ifdef HAVE_TARGET_64_LITTLE
 template
 void
-gold_undefined_symbol<64, false>(const Symbol* sym,
-                                const Relocate_info<64, false>* relinfo,
-                                size_t relnum, off_t reloffset);
+gold_undefined_symbol_at_location<64, false>(
+    const Symbol* sym,
+    const Relocate_info<64, false>* relinfo,
+    size_t relnum, off_t reloffset);
 #endif
 
 #ifdef HAVE_TARGET_64_BIG
 template
 void
-gold_undefined_symbol<64, true>(const Symbol* sym,
-                               const Relocate_info<64, true>* relinfo,
-                               size_t relnum, off_t reloffset);
+gold_undefined_symbol_at_location<64, true>(
+    const Symbol* sym,
+    const Relocate_info<64, true>* relinfo,
+    size_t relnum, off_t reloffset);
 #endif
 
 } // End namespace gold.