diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2017-12-14 18:59:24 +0000 |
---|---|---|
committer | Bernd Edlinger <edlinger@gcc.gnu.org> | 2017-12-14 18:59:24 +0000 |
commit | c65e18d3331aa9995ddab8527132de706f6d9236 (patch) | |
tree | c07ca2eb9958d996e27a70559a3a4e136ba98e58 /gcc/c-family | |
parent | 9d0e85af87d9e7fe3bd68d1647b7c47ad299f011 (diff) | |
download | gcc-c65e18d3331aa9995ddab8527132de706f6d9236.zip gcc-c65e18d3331aa9995ddab8527132de706f6d9236.tar.gz gcc-c65e18d3331aa9995ddab8527132de706f6d9236.tar.bz2 |
invoke.texi: Document -Wcast-function-type.
gcc:
2017-12-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* doc/invoke.texi: Document -Wcast-function-type.
* recog.h (stored_funcptr): Change signature.
* tree-dump.c (dump_node): Avoid warning.
* typed-splay-tree.h (typed_splay_tree): Avoid warning.
libcpp:
2017-12-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* internal.h (maybe_print_line): Change signature.
c-family:
2017-12-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* c.opt (Wcast-function-type): New warning option.
* c-lex.c (get_fileinfo): Avoid warning.
* c-ppoutput.c (scan_translation_unit_directives_only): Remove cast.
c:
2017-12-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* c-typeck.c (c_safe_arg_type_equiv_p,
c_safe_function_type_cast_p): New function.
(build_c_cast): Implement -Wcast-function-type.
cp:
2017-12-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* decl2.c (start_static_storage_duration_function): Avoid warning.
* typeck.c (cxx_safe_arg_type_equiv_p,
cxx_safe_function_type_cast_p): New function.
(build_reinterpret_cast_1): Implement -Wcast-function-type.
testsuite:
2017-12-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* c-c++-common/Wcast-function-type.c: New test.
* g++.dg/Wcast-function-type.C: New test.
From-SVN: r255661
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-lex.c | 6 | ||||
-rw-r--r-- | gcc/c-family/c-ppoutput.c | 2 | ||||
-rw-r--r-- | gcc/c-family/c.opt | 4 |
4 files changed, 15 insertions, 3 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index abe5301..9f87d00 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2017-12-14 Bernd Edlinger <bernd.edlinger@hotmail.de> + + * c.opt (Wcast-function-type): New warning option. + * c-lex.c (get_fileinfo): Avoid warning. + * c-ppoutput.c (scan_translation_unit_directives_only): Remove cast. + 2017-12-14 Qing Zhao <qing.zhao@oracle.com> PR middle_end/79538 diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 8342800..d45dc4b 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -101,9 +101,11 @@ get_fileinfo (const char *name) struct c_fileinfo *fi; if (!file_info_tree) - file_info_tree = splay_tree_new ((splay_tree_compare_fn) strcmp, + file_info_tree = splay_tree_new ((splay_tree_compare_fn) + (void (*) (void)) strcmp, 0, - (splay_tree_delete_value_fn) free); + (splay_tree_delete_value_fn) + (void (*) (void)) free); n = splay_tree_lookup (file_info_tree, (splay_tree_key) name); if (n) diff --git a/gcc/c-family/c-ppoutput.c b/gcc/c-family/c-ppoutput.c index d1c9237..32176ed 100644 --- a/gcc/c-family/c-ppoutput.c +++ b/gcc/c-family/c-ppoutput.c @@ -299,7 +299,7 @@ scan_translation_unit_directives_only (cpp_reader *pfile) struct _cpp_dir_only_callbacks cb; cb.print_lines = print_lines_directives_only; - cb.maybe_print_line = (void (*) (source_location)) maybe_print_line; + cb.maybe_print_line = maybe_print_line; _cpp_preprocess_dir_only (pfile, &cb); } diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index b254810..31b50ee 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -384,6 +384,10 @@ Wc++17-compat C++ ObjC++ Var(warn_cxx17_compat) Warning LangEnabledBy(C++ ObjC++,Wall) Warn about C++ constructs whose meaning differs between ISO C++ 2014 and ISO C++ 2017. +Wcast-function-type +C ObjC C++ ObjC++ Var(warn_cast_function_type) Warning EnabledBy(Wextra) +Warn about casts between incompatible function types. + Wcast-qual C ObjC C++ ObjC++ Var(warn_cast_qual) Warning Warn about casts which discard qualifiers. |