diff options
author | Nathan Froyd <froydnj@codesourcery.com> | 2010-11-24 23:29:41 +0000 |
---|---|---|
committer | Nathan Froyd <froydnj@gcc.gnu.org> | 2010-11-24 23:29:41 +0000 |
commit | a3abe41c30c8f779e203452a0b31a33b825565c7 (patch) | |
tree | f82e67116455c990ac9fdc580e1af29b8e486995 /gcc/cp | |
parent | fb9041eab317593ef2d1b38b2258d17e5e17bb6c (diff) | |
download | gcc-a3abe41c30c8f779e203452a0b31a33b825565c7.zip gcc-a3abe41c30c8f779e203452a0b31a33b825565c7.tar.gz gcc-a3abe41c30c8f779e203452a0b31a33b825565c7.tar.bz2 |
cppbuiltin.c (define_builtin_macros_for_type_sizes): Define __FLOAT_WORD_ORDER__ according to FLOAT_WORDS_BIG_ENDIAN.
gcc/
* 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__.
From-SVN: r167129
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/cp-tree.h | 3 | ||||
-rw-r--r-- | gcc/cp/error.c | 1 | ||||
-rw-r--r-- | gcc/cp/lex.c | 5 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 69 |
4 files changed, 77 insertions, 1 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 67f4f93..a323501 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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 */ diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 1560fc6..de45efe 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -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; diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index c583d7d..9c6be41 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -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) diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index dc73544..0ee80e4 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -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. */ |