+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
#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
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 */
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;
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)
#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. */
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. */
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",
#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
{
/* 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
"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
&& (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)
{
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
void foo() {
printf("abc"); // { dg-error "not declared" }
+ // { dg-message "note" "suggested alternative" { target *-*-* } 12 }
}
namespace N { int i; }
void foo() { i; } // { dg-error "not declared" }
+ // { dg-message "note" "suggested alternative" { target *-*-* } 6 }
using namespace N;
void bar() { i; }
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
Three (b); // ok
Three (a, b); // ok
Three (a); // { dg-error "not declared" }
+ // { dg-message "note" "suggested alternative" { target *-*-* } 47 }
}
B *bp;
N::A *ap;
f (bp); // { dg-error "not declared" }
+ // { dg-message "note" "suggested alternative" { target *-*-* } 16 }
f (ap);
}
int main()
{
return sizeof(X); // { dg-error "" "" }
+ // { dg-message "note" "suggested alternative" { target *-*-* } 15 }
}
{
template<> void
vector<int, allocator<int> >::swap(vector<int, allocator<int> >&) { } // { dg-error "" }
+ // { dg-message "note" "suggested alternative" { target *-*-* } 22 }
}
}
int j = i; // { dg-error "" }
+ // { dg-message "note" "suggested alternative" { target *-*-* } 6 }
namespace B {
int j = i; // { dg-error "" }
+ // { dg-message "note" "suggested alternative" { target *-*-* } 8 }
}
// 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 }
}
inline void
bar() {
foo("",count); // { dg-error "" } multiple overloaded count functions
+ // { dg-message "note" "suggested alternative" { target *-*-* } 12 }
}
class A {
public:
int kaka(tmp::B = b); // { dg-error "" } no b in scope
+ // { dg-message "note" "suggested alternative" { target *-*-* } 18 }
};
+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.
#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
+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
#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
#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