]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc/
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 24 Nov 2010 23:29:41 +0000 (23:29 +0000)
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 24 Nov 2010 23:29:41 +0000 (23:29 +0000)
* cppbuiltin.c (define_builtin_macros_for_type_sizes): Define
__FLOAT_WORD_ORDER__ according to FLOAT_WORDS_BIG_ENDIAN.
* config/dfp-bit.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete.
* doc/cpp.texi (__FLOAT_WORD_ORDER__): Document.
* system.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Poison.

libgcc/
* config/libbid/bid_conf.h (BID_BIG_ENDIAN): Define in terms of
__FLOAT_WORD_ORDER__.
* config/libbid/bid_gcc_intrinsics.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN):
Delete.

libdecnumber/
* dconfig.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete.
(WORDS_BIG_ENDIAN): Define based on value of __FLOAT_WORD_ORDER__.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167129 138bc75d-0d04-0410-961f-82ee72b054a4

28 files changed:
gcc/ChangeLog
gcc/config/dfp-bit.h
gcc/cp/cp-tree.h
gcc/cp/error.c
gcc/cp/lex.c
gcc/cp/name-lookup.c
gcc/cppbuiltin.c
gcc/doc/cpp.texi
gcc/lto/lto.c
gcc/params.def
gcc/reload1.c
gcc/system.h
gcc/testsuite/g++.dg/ext/builtin3.C
gcc/testsuite/g++.dg/lookup/error1.C
gcc/testsuite/g++.dg/lookup/koenig5.C
gcc/testsuite/g++.dg/overload/koenig1.C
gcc/testsuite/g++.dg/parse/decl-specifier-1.C
gcc/testsuite/g++.dg/template/static10.C
gcc/testsuite/g++.old-deja/g++.mike/ns5.C
gcc/testsuite/g++.old-deja/g++.mike/ns7.C
gcc/testsuite/g++.old-deja/g++.ns/koenig5.C
gcc/testsuite/g++.old-deja/g++.ns/koenig9.C
gcc/testsuite/g++.old-deja/g++.other/lineno5.C
libdecnumber/ChangeLog
libdecnumber/dconfig.h
libgcc/ChangeLog
libgcc/config/libbid/bid_conf.h
libgcc/config/libbid/bid_gcc_intrinsics.h

index ec3b96f664d8407ae4940c595b03cf3abb518093..85ff5a9a44c16c5497a3064304419a3c62e46ebc 100644 (file)
@@ -1,3 +1,11 @@
+2010-11-24  Nathan Froyd  <froydnj@codesourcery.com>
+
+       * cppbuiltin.c (define_builtin_macros_for_type_sizes): Define
+       __FLOAT_WORD_ORDER__ according to FLOAT_WORDS_BIG_ENDIAN.
+       * config/dfp-bit.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete.
+       * doc/cpp.texi (__FLOAT_WORD_ORDER__): Document.
+       * system.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Poison.
+
 2010-11-24  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/46519
index 20688b19a1e0216bf7542159d1dbe2b622bc132a..c1ee3777aabc3eec5476aca431c163f34ee1f75f 100644 (file)
@@ -33,11 +33,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "coretypes.h"
 #include "tm.h"
 
-#ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
-#define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN \
-  (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__)
-#endif
-
 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
 #endif
index 67f4f93d2b2f6b90c6a1d5eb622bcffe946049d4..a32350175a82a7e91f999ef0f6291d1aa431a370 100644 (file)
@@ -5639,6 +5639,9 @@ extern tree cxx_omp_clause_dtor                   (tree, tree);
 extern void cxx_omp_finish_clause              (tree);
 extern bool cxx_omp_privatize_by_reference     (const_tree);
 
+/* in name-lookup.c */
+extern void suggest_alternatives_for (tree);
+
 /* -- end of C++ */
 
 #endif /* ! GCC_CP_TREE_H */
index 1560fc6047be211ac420b35d9d52660c5c0a3a73..de45efe37d48e8bbcef2effdec5d8326eabd6f82 100644 (file)
@@ -1700,6 +1700,7 @@ dump_expr (tree t, int flags)
     case NAMESPACE_DECL:
     case LABEL_DECL:
     case OVERLOAD:
+    case TYPE_DECL:
     case IDENTIFIER_NODE:
       dump_decl (t, (flags & ~TFF_DECL_SPECIFIERS) | TFF_NO_FUNCTION_ARGUMENTS);
       break;
index c583d7d307e80bc3e1a0091c2fd1628c9e9fa73a..9c6be413835b8cd3aaacefbc952c1efde345b3cc 100644 (file)
@@ -450,7 +450,10 @@ unqualified_name_lookup_error (tree name)
   else
     {
       if (!objc_diagnose_private_ivar (name))
-        error ("%qD was not declared in this scope", name);
+       {
+         error ("%qD was not declared in this scope", name);
+         suggest_alternatives_for (name);
+       }
       /* Prevent repeated error messages by creating a VAR_DECL with
         this NAME in the innermost block scope.  */
       if (current_function_decl)
index dc735443db251ad3e836aa88d56622f9f3bac38e..0ee80e4d1408c746370f75f356a84c8f18d9da3b 100644 (file)
@@ -30,8 +30,10 @@ along with GCC; see the file COPYING3.  If not see
 #include "timevar.h"
 #include "toplev.h"
 #include "diagnostic-core.h"
+#include "intl.h"
 #include "debug.h"
 #include "c-family/c-pragma.h"
+#include "params.h"
 
 /* The bindings for a particular name in a particular scope.  */
 
@@ -3917,6 +3919,73 @@ remove_hidden_names (tree fns)
   return fns;
 }
 
+/* Suggest alternatives for NAME, an IDENTIFIER_NODE for which name
+   lookup failed.  Search through all available namespaces and print out
+   possible candidates.  */
+
+void
+suggest_alternatives_for (tree name)
+{
+  VEC(tree,heap) *candidates = NULL;
+  VEC(tree,heap) *namespaces_to_search = NULL;
+  int max_to_search = PARAM_VALUE (CXX_MAX_NAMESPACES_FOR_DIAGNOSTIC_HELP);
+  int n_searched = 0;
+  char *spaces;
+  const char *str;
+  tree t;
+  unsigned ix;
+
+  VEC_safe_push (tree, heap, namespaces_to_search, global_namespace);
+
+  while (!VEC_empty (tree, namespaces_to_search)
+        && n_searched < max_to_search)
+    {
+      tree scope = VEC_pop (tree, namespaces_to_search);
+      struct scope_binding binding = EMPTY_SCOPE_BINDING;
+      struct cp_binding_level *level = NAMESPACE_LEVEL (scope);
+
+      /* Look in this namespace.  */
+      qualified_lookup_using_namespace (name, scope, &binding, 0);
+
+      n_searched++;
+
+      if (binding.value)
+       VEC_safe_push (tree, heap, candidates, binding.value);
+
+      /* Add child namespaces.  */
+      for (t = level->namespaces; t; t = DECL_CHAIN (t))
+       VEC_safe_push (tree, heap, namespaces_to_search, t);
+    }
+
+  /* If we stopped before we could examine all namespaces, inform the
+     user.  Do this even if we don't have any candidates, since there
+     might be more candidates further down that we weren't able to
+     find.  */
+  if (n_searched >= max_to_search)
+    inform (input_location,
+           "maximum limit of %d namespaces searched for %qE",
+           max_to_search, name);
+
+  /* Nothing useful to report.  */
+  if (VEC_empty (tree, candidates))
+    return;
+
+  str = (VEC_length(tree, candidates) > 1
+        ? _("suggested alternatives:")
+        : _("suggested alternative:"));
+  spaces = NULL;
+
+  FOR_EACH_VEC_ELT (tree, candidates, ix, t)
+    {
+      inform (input_location, "%s %qE", (spaces ? spaces : str), t);
+      spaces = spaces ? spaces : get_spaces (str);
+    }
+
+  VEC_free (tree, heap, candidates);
+  VEC_free (tree, heap, namespaces_to_search);
+  free (spaces);
+}
+
 /* Unscoped lookup of a global: iterate over current namespaces,
    considering using-directives.  */
 
index ffee4c0299494541f3c11f65f19efcba42123e66..ee00de5d4682b62b38928b81e644b9459b89b090 100644 (file)
@@ -157,6 +157,11 @@ define_builtin_macros_for_type_sizes (cpp_reader *pfile)
       cpp_define (pfile, "__BYTE_ORDER__=__ORDER_PDP_ENDIAN__");
     }
 
+  cpp_define_formatted (pfile, "__FLOAT_WORD_ORDER__=%s",
+                        (FLOAT_WORDS_BIG_ENDIAN
+                         ? "__ORDER_BIG_ENDIAN__"
+                         : "__ORDER_LITTLE_ENDIAN__"));
+
   /* ptr_type_node can't be used here since ptr_mode is only set when
      toplev calls backend_init which is not done with -E switch.  */
   cpp_define_formatted (pfile, "__SIZEOF_POINTER__=%d",
index ddcf81467f6784a88bd9674fc8c46e883c2bd6cc..7d78d1213aed55cec1d91da1144c896dfb7ad5fa 100644 (file)
@@ -2289,6 +2289,11 @@ You should use these macros for testing like this:
 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 @end smallexample
 
+@item __FLOAT_WORD_ORDER__
+@code{__FLOAT_WORD_ORDER__} is defined to one of the values
+@code{__ORDER_LITTLE_ENDIAN__} or @code{__ORDER_BIG_ENDIAN__} to reflect
+the layout of the words of multi-word floating-point quantities.
+
 @item __DEPRECATED
 This macro is defined, with value 1, when compiling a C++ source file
 with warnings about deprecated constructs enabled.  These warnings are
index 3db5ac1bbd85afbc5a0a5debf435a6767016cc23..fcb66ce92e6549bec81e16317138c0dc1d7cf7a4 100644 (file)
@@ -1932,7 +1932,6 @@ lto_fixup_tree (tree *tp, int *walk_subtrees, void *data)
        {
          /* walk_tree only handles TREE_OPERANDs. Do the rest here.  */
          lto_fixup_common (t, data);
-         LTO_FIXUP_SUBTREE (t->exp.block);
          *walk_subtrees = 1;
        }
       else
index 6b6e05500b53f7cfc1a0fb178c422674cefe1a88..2ea00137b2b36d72a9d1a08e0f820b6bf373f95c 100644 (file)
@@ -855,6 +855,15 @@ DEFPARAM (MIN_PARTITION_SIZE,
          "lto-min-partition",
          "Size of minimal paritition for WHOPR (in estimated instructions)",
          1000, 0, 0)
+
+/* Diagnostic parameters.  */
+
+DEFPARAM (CXX_MAX_NAMESPACES_FOR_DIAGNOSTIC_HELP,
+         "cxx-max-namespaces-for-diagnostic-help",
+         "Maximum number of namespaces to search for alternatives when "
+         "name lookup fails",
+         1000, 0, 0)
+
 /*
 Local variables:
 mode:c
index da354a7e32536c94ffbae1a506054d294b560507..2f02ae381582d7403e8d9a8c614f440decf42ec3 100644 (file)
@@ -6600,17 +6600,6 @@ choose_reload_regs (struct insn_chain *chain)
              && (rld[r].nregs == max_group_size
                  || ! reg_classes_intersect_p (rld[r].rclass, group_class)))
            search_equiv = rld[r].in;
-         /* If this is an output reload from a simple move insn, look
-            if an equivalence for the input is available.  */
-         else if (inheritance && rld[r].in == 0 && rld[r].out != 0)
-           {
-             rtx set = single_set (insn);
-
-             if (set
-                 && rtx_equal_p (rld[r].out, SET_DEST (set))
-                 && CONSTANT_P (SET_SRC (set)))
-               search_equiv = SET_SRC (set);
-           }
 
          if (search_equiv)
            {
index 4de117ec35f2019378036a144e47ce89695000b7..fbeab0fd7a6d814aaee065f423daac302e8ff7ff 100644 (file)
@@ -800,7 +800,8 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
        TARGET_HANDLE_OFAST TARGET_OPTION_OPTIMIZATION
 
 /* Hooks into libgcc2.  */
- #pragma GCC poison LIBGCC2_DOUBLE_TYPE_SIZE LIBGCC2_WORDS_BIG_ENDIAN
+ #pragma GCC poison LIBGCC2_DOUBLE_TYPE_SIZE LIBGCC2_WORDS_BIG_ENDIAN \
+   LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
 
 /* Miscellaneous macros that are no longer used.  */
  #pragma GCC poison USE_MAPPED_LOCATION
index 3d06dd7534ae146e63b529de21cfc74bef71cbf0..a9ebce0417ff9b1585d098e63ab45c9205fea772 100644 (file)
@@ -10,4 +10,5 @@ extern "C" int printf(char*, ...);
 
 void foo() {
   printf("abc");               // { dg-error "not declared" }
+  // { dg-message "note" "suggested alternative" { target *-*-* } 12 }
 }
index 2264b238403c96f5a81a749cb09916f2ca20e8d3..3b34ee394dd2052dec429613addc0eb8b6d9e690 100644 (file)
@@ -4,6 +4,7 @@
 
 namespace N { int i; }
 void foo() { i; }   // { dg-error "not declared" }
+  // { dg-message "note" "suggested alternative" { target *-*-* } 6 }
 
 using namespace N;
 void bar() { i; }
index 6ecc25daadb9ac8a60e7581ce1fd8a8b8260b829..bc1dc8cb73d7dcb4ed2a0ec93e4f9af46f8fe94a 100644 (file)
@@ -32,10 +32,12 @@ void g (N::A *a, M::B *b, O::C *c)
   One (a); // ok
   One (a, b); // ok
   One (b); // { dg-error "not declared" }
+  // { dg-message "note" "suggested alternative" { target *-*-* } 34 }
 
   Two (c); // ok
   Two (a, c); // ok
   Two (a); // { dg-error "not declared" }
+  // { dg-message "note" "suggested alternative" { target *-*-* } 39 }
   Two (a, a); // error masked by earlier error
   Two (b); // error masked by earlier error
   Two (a, b); // error masked by earlier error
@@ -43,4 +45,5 @@ void g (N::A *a, M::B *b, O::C *c)
   Three (b); // ok
   Three (a, b); // ok
   Three (a); // { dg-error "not declared" }
+  // { dg-message "note" "suggested alternative" { target *-*-* } 47 }
 }
index 1ed7bce0b146d95f4db7b88a9be408a87d2331a5..be0be6936f017edebf983ceb9064942dd99a62cb 100644 (file)
@@ -14,5 +14,6 @@ void g ()
   B *bp;
   N::A *ap;
   f (bp);                      // { dg-error "not declared" }
+  // { dg-message "note" "suggested alternative" { target *-*-* } 16 }
   f (ap);
 }
index e81fbabf2c34f5753fa84df244f416d823203050..48fc7fafd8ec0288636338f41ddbd48ae87f5212 100644 (file)
@@ -13,4 +13,5 @@ N::X X;                           // { dg-error "" "" }
 int main()
 {
     return sizeof(X);             // { dg-error "" "" }
+    // { dg-message "note" "suggested alternative" { target *-*-* } 15 }
 }
index ab857bd814e28fdd4e2c844ad39e09a5aa6e7719..2f60f0c94e26e6d8ff29c8a41070d9c923caabcf 100644 (file)
@@ -20,4 +20,5 @@ namespace std
 {
   template<> void
   vector<int, allocator<int> >::swap(vector<int, allocator<int> >&) { } // { dg-error "" }
+  // { dg-message "note" "suggested alternative" { target *-*-* } 22 }
 }
index 9d806cabdb314795526adaa0ff12c4ba03ed7e51..f13da047cb93ab22884ede5fc6a13c5945d53fa0 100644 (file)
@@ -4,3 +4,4 @@ namespace A {
 }
 
 int j = i;             // { dg-error "" } 
+  // { dg-message "note" "suggested alternative" { target *-*-* } 6 }
index 57008dbed614f0f33d004ae2dd36fbd78aed3825..31a71dd35f1ae21810c4d2758b4c71bf29406f73 100644 (file)
@@ -6,4 +6,5 @@ namespace A {
 
 namespace B {
   int j = i;   // { dg-error "" } 
+  // { dg-message "note" "suggested alternative" { target *-*-* } 8 }
 }
index 33061ad0bd8ae9e2f74ef39df451f5e281bee174..67b781dd8cfba12925dc1e242f4168d4fee7d751 100644 (file)
@@ -15,4 +15,5 @@ void g()
                         // foo variable first, and therefore do not
                         // perform argument-dependent lookup.
   bar(new X);            // { dg-error "not declared" }
+  // { dg-message "note" "suggested alternative" { target *-*-* } 17 }
 }
index 78b0e8b36ca1ecd2cc8bfd8b586c2da489af5cc0..f246639d4f4a77b1212e6e31fe282172ff35b802 100644 (file)
@@ -10,4 +10,5 @@ void foo(const char*,...);
 inline void
 bar() {
   foo("",count);    //  { dg-error "" } multiple overloaded count functions
+  // { dg-message "note" "suggested alternative" { target *-*-* } 12 }
 }
index d14bd90c2db3660adb01ddbeda113568c8b43347..20e49bc7b7d1afa86303d60dbc0b984bf8362923 100644 (file)
@@ -16,4 +16,5 @@ namespace tmp {
 class A {
   public:
   int kaka(tmp::B = b);                // { dg-error "" } no b in scope
+  // { dg-message "note" "suggested alternative" { target *-*-* } 18 }
 };
index d2d6d5947ec881a60263f9042450314828ab70b6..101cda9e37cc9b17a18b7a8b5151724de0982fa7 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-24  Nathan Froyd  <froydnj@codesourcery.com>
+
+       * dconfig.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete.
+       (WORDS_BIG_ENDIAN): Define based on value of __FLOAT_WORD_ORDER__.
+
 2010-10-23  Nathan Froyd  <froydnj@codesourcery.com>
 
        * dconfig.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete.
index 26b963c9480f526d2842806599837bf0d74cf042..503cb61e02d9708a4808e7c2806cdf971b9b7ac5 100644 (file)
@@ -28,12 +28,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "coretypes.h"
 #include "tm.h"
 
-#ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
-#define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN \
-  (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__)
-#endif
-
-#if LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
+#if __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
 #define WORDS_BIGENDIAN 1
 #endif
 
index 0f18b561aca56d3b208f8a2f50e0c128b0b04de7..0e31d98d5e30c1e31318ae41ea39692cb2062cc5 100644 (file)
@@ -1,3 +1,10 @@
+2010-11-24  Nathan Froyd  <froydnj@codesourcery.com>
+
+       * config/libbid/bid_conf.h (BID_BIG_ENDIAN): Define in terms of
+       __FLOAT_WORD_ORDER__.
+       * config/libbid/bid_gcc_intrinsics.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN):
+       Delete.
+
 2010-11-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        PR other/46202
index d22980d9d2a90cd89b87793599d8645353e07d58..93e60edb08af81399110219bd302b7e3f724b8b6 100644 (file)
@@ -516,7 +516,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #endif
 
 #ifndef BID_BIG_ENDIAN
-#define BID_BIG_ENDIAN LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
+#define BID_BIG_ENDIAN __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
 #endif
 
 #ifndef BID_THREAD
index f536e3b1bd4c2556f84a37912ad89d9d885685c1..7d65705a4ddda369e2193996a299fdff28a0138a 100644 (file)
@@ -30,11 +30,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "coretypes.h"
 #include "tm.h"
 
-#ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
-#define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN \
-  (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__)
-#endif
-
 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
 #endif