Re: [PATCH] lto-wrapper.c (copy_file): Fix resource leaks
Le 16/05/2017 à 09:59, Sylvestre Ledru a écrit : > Le 15/05/2017 à 23:58, Jeff Law a écrit : >> On 05/14/2017 04:00 AM, Sylvestre Ledru wrote: >>> Add missing fclose >>> CID 1407987, 1407986 >>> >>> S >>> >>> >>> >>> 0005-2017-05-14-Sylvestre-Ledru-sylvestre-debian.org.patch >>> >>> >>> From d255827a64012fb81937d6baa8534eabecf9b735 Mon Sep 17 00:00:00 2001 >>> From: Sylvestre Ledru<sylves...@debian.org> >>> Date: Sun, 14 May 2017 11:37:37 +0200 >>> Subject: [PATCH 5/5] 2017-05-14 Sylvestre Ledru<sylves...@debian.org> >>> >>> * lto-wrapper.c (copy_file): Fix resource leaks >>>CID 1407987, 1407986 >> Doesn't this still leak in the cases were we call fatal_error? > Indeed. thanks! Patch updated! > ping ? S
Re: libdecnumber/bid/bid2dpd_dpd2bid.c: Simplify code
Le 26/05/2017 à 15:34, Sylvestre Ledru a écrit : > Hello, > > The attach patch (dup.diff) performs the following changes: > > * bid/bid2dpd_dpd2bid.c: Remove identical code for different > branches (CID 1286836, 1286837, 1286838) > Remove some useless } else { declaration as we are returning > Remove some whitespace changes & tab > > i attached the word diff to highlight the change. > > No functional changes! The identical code has been found by coverity. > > Thanks! > > S > > ping?
libdecnumber/bid/bid2dpd_dpd2bid.c: Simplify code
Hello, The attach patch (dup.diff) performs the following changes: * bid/bid2dpd_dpd2bid.c: Remove identical code for different branches (CID 1286836, 1286837, 1286838) Remove some useless } else { declaration as we are returning Remove some whitespace changes & tab i attached the word diff to highlight the change. No functional changes! The identical code has been found by coverity. Thanks! S libdecnumber/ChangeLog: 2017-05-26 Sylvestre Ledru <sylves...@debian.org> * bid/bid2dpd_dpd2bid.c: Remove identical code for different branches (CID 1286836, 1286837, 1286838) Remove some useless } else { declaration as we are returning Remove some whitespace changes & tab Index: libdecnumber/bid/bid2dpd_dpd2bid.c === --- libdecnumber/bid/bid2dpd_dpd2bid.c (révision 248086) +++ libdecnumber/bid/bid2dpd_dpd2bid.c (copie de travail) @@ -114,10 +114,10 @@ b1 = b01 - 1000 * b0; dcoeff = b2d[b2] | b2d2[b1]; if (b0 >= 8) { /* is b0 8 or 9? */ -res = sign | ((0x600 | ((exp >> 6) << 7) | +res = sign | ((0x600 | ((exp >> 6) << 7) | ((b0 & 1) << 6) | (exp & 0x3f)) << 20) | dcoeff; } else { /* else b0 is 0..7 */ -res = sign | exp >> 6) << 9) | (b0 << 6) | +res = sign | exp >> 6) << 9) | (b0 << 6) | (exp & 0x3f)) << 20) | dcoeff; } *pres = res; @@ -138,30 +138,30 @@ if ((x & 0x7800) == 0x7800) { *pres = x; return; - } else { /* normal number */ -if ((x & 0x6000) == 0x6000) { /* G0..G1 = 11 -> d0 = 8 + G4 */ - d0 = d2b3[((x >> 26) & 1) | 8]; /* d0 = (comb & 0x0100 ? 9 : 8); */ - exp = (x >> 27) & 3; /* exp leading bits are G2..G3 */ -} else { - d0 = d2b3[(x >> 26) & 0x7]; - exp = (x >> 29) & 3; /* exp loading bits are G0..G1 */ -} -d1 = d2b2[(trailing >> 10) & 0x3ff]; -d2 = d2b[(trailing) & 0x3ff]; -bcoeff = d2 + d1 + d0; -exp = (exp << 6) + ((x >> 20) & 0x3f); -if (bcoeff < (1 << 23)) { - r = exp; - r <<= 23; - r |= (bcoeff | sign); -} else { - r = exp; - r <<= 21; - r |= (sign | 0x6000ul); - /* add coeff, without leading bits */ - r |= (((unsigned int) bcoeff) & 0x1f); -} } + /* normal number */ + if ((x & 0x6000) == 0x6000) { /* G0..G1 = 11 -> d0 = 8 + G4 */ +d0 = d2b3[((x >> 26) & 1) | 8]; /* d0 = (comb & 0x0100 ? 9 : 8); */ +exp = (x >> 27) & 3; /* exp leading bits are G2..G3 */ + } else { +d0 = d2b3[(x >> 26) & 0x7]; +exp = (x >> 29) & 3; /* exp loading bits are G0..G1 */ + } + d1 = d2b2[(trailing >> 10) & 0x3ff]; + d2 = d2b[(trailing) & 0x3ff]; + bcoeff = d2 + d1 + d0; + exp = (exp << 6) + ((x >> 20) & 0x3f); + if (bcoeff < (1 << 23)) { +r = exp; +r <<= 23; +r |= (bcoeff | sign); + } else { +r = exp; +r <<= 21; +r |= (sign | 0x6000ul); +/* add coeff, without leading bits */ +r |= (((unsigned int) bcoeff) & 0x1f); + } *pres = r; } @@ -184,40 +184,40 @@ if ((comb & 0xf00) == 0xf00) { *pres = x; return; - } else { /* Normal number */ -if ((comb & 0xc00) == 0xc00) { /* G0..G1 = 11 -> exp is G2..G11 */ - exp = (comb) & 0x3ff; - bcoeff = (x & 0x0007ull) | 0x0020ull; -} else { - exp = (comb >> 2) & 0x3ff; - bcoeff = (x & 0x001full); -} -D61 = 2305843009ull; /* Floor(2^61 / 10^9) */ -/* Multiply the binary coefficient by ceil(2^64 / 1000), and take the upper - 64-bits in order to compute a division by 1000. */ -yhi = (D61 * (UINT64)(bcoeff >> (UINT64)27)) >> (UINT64)34; -ylo = bcoeff - 10ull * yhi; -if (ylo >= 10) { - ylo = ylo - 10; - yhi = yhi + 1; -} -d103 = 0x4189374c; -B34 = ((UINT64) ylo * d103) >> (32 + 8); -B01 = ((UINT64) yhi * d103) >> (32 + 8); -b5 = ylo - B34 * 1000; -b2 = yhi - B01 * 1000; -b3 = ((UINT64) B34 * d103) >> (32 + 8); -b0 = ((UINT64) B01 * d103) >> (32 + 8); -b4 = (unsigned int) B34 - (unsigned int) b3 *1000; -b1 = (unsigned int) B01 - (unsigned int) dm103[b0]; -dcoeff = b2d[b5] | b2d2[b4] | b2d3[b3] | b2d4[b2] | b2d5[b1]; -if (b0 >= 8) /* is b0 8 or 9? */ - res = sign | ((0x1800 | ((exp >> 8) << 9) | ((b0 & 1) << 8) | - (exp & 0xff)) << 50) | dcoeff; -else /* else b0 is 0..7 */ - res = sign | exp >> 8) << 11) | (b0 << 8) | - (exp &am
Re: [PATCH] lto-wrapper.c (copy_file): Fix resource leaks
Le 15/05/2017 à 23:58, Jeff Law a écrit : > On 05/14/2017 04:00 AM, Sylvestre Ledru wrote: >> Add missing fclose >> CID 1407987, 1407986 >> >> S >> >> >> >> 0005-2017-05-14-Sylvestre-Ledru-sylvestre-debian.org.patch >> >> >> From d255827a64012fb81937d6baa8534eabecf9b735 Mon Sep 17 00:00:00 2001 >> From: Sylvestre Ledru<sylves...@debian.org> >> Date: Sun, 14 May 2017 11:37:37 +0200 >> Subject: [PATCH 5/5] 2017-05-14 Sylvestre Ledru<sylves...@debian.org> >> >> * lto-wrapper.c (copy_file): Fix resource leaks >>CID 1407987, 1407986 > Doesn't this still leak in the cases were we call fatal_error? Indeed. thanks! Patch updated! S fclose.dif Description: video/dv
Re: [PATCH] plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637)
Le 14/05/2017 à 12:40, Trevor Saunders a écrit : > On Sun, May 14, 2017 at 11:59:40AM +0200, Sylvestre Ledru wrote: >> Add missing dlclose() >> >> S >> >> >> From d0926b84047f281a29dc51bbd0a4bdda01a5c63f Mon Sep 17 00:00:00 2001 >> From: Sylvestre Ledru <sylves...@debian.org> >> Date: Sun, 14 May 2017 11:28:38 +0200 >> Subject: [PATCH 4/5] 2017-05-14 Sylvestre Ledru <sylves...@debian.org> >> >> * plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637) >> --- >> gcc/plugin.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/gcc/plugin.c b/gcc/plugin.c >> index cfd6ef25036..903a197b78b 100644 >> --- a/gcc/plugin.c >> +++ b/gcc/plugin.c >> @@ -617,6 +617,7 @@ try_init_one_plugin (struct plugin_name_args *plugin) >> >>if ((err = dlerror ()) != NULL) >> { >> + dlclose(dl_handle); >>error ("cannot find %s in plugin %s\n%s", str_plugin_init_func_name, >> plugin->full_name, err); >>return false; >> @@ -625,10 +626,12 @@ try_init_one_plugin (struct plugin_name_args *plugin) >>/* Call the plugin-provided initialization routine with the arguments. */ >>if ((*plugin_init) (plugin, _version)) >> { >> + dlclose(dl_handle); > These seem like unimportant, but real leaks so they seem correct. > >>error ("fail to initialize plugin %s", plugin->full_name); >>return false; >> } >> >> + dlclose(dl_handle); > Does this part pass the plugin tests? because it seems suspicious, if > the plugin's init function registered any callbacks which it almost > certainly did, then we'd be holding function pointers into the plugin > after we dlclosed our only reference to it. We don't need to call any > more functions with the handle, but I think we want to morally leak it > here to ensure the plugin is loaded for the entire run of the compiler. > Indeed, false positive marked in the coverity interface. New patch attached S >From 08f3fb989f6b6ee56e1d4d9674e743dd563a0904 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru <sylves...@debian.org> Date: Sun, 14 May 2017 11:28:38 +0200 Subject: [PATCH 1/2] 2017-05-14 Sylvestre Ledru <sylves...@debian.org> * plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637) --- gcc/plugin.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/plugin.c b/gcc/plugin.c index cfd6ef25036..60d037c2b83 100644 --- a/gcc/plugin.c +++ b/gcc/plugin.c @@ -617,6 +617,7 @@ try_init_one_plugin (struct plugin_name_args *plugin) if ((err = dlerror ()) != NULL) { + dlclose(dl_handle); error ("cannot find %s in plugin %s\n%s", str_plugin_init_func_name, plugin->full_name, err); return false; @@ -625,6 +626,7 @@ try_init_one_plugin (struct plugin_name_args *plugin) /* Call the plugin-provided initialization routine with the arguments. */ if ((*plugin_init) (plugin, _version)) { + dlclose(dl_handle); error ("fail to initialize plugin %s", plugin->full_name); return false; } -- 2.11.0
[PATCH] lto-wrapper.c (copy_file): Fix resource leaks
Add missing fclose CID 1407987, 1407986 S >From d255827a64012fb81937d6baa8534eabecf9b735 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru <sylves...@debian.org> Date: Sun, 14 May 2017 11:37:37 +0200 Subject: [PATCH 5/5] 2017-05-14 Sylvestre Ledru <sylves...@debian.org> * lto-wrapper.c (copy_file): Fix resource leaks CID 1407987, 1407986 --- gcc/lto-wrapper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index 4b86f939ca2..832ffde3e40 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -838,6 +838,8 @@ copy_file (const char *dest, const char *src) fatal_error (input_location, "writing output file"); } } + fclose (d); + fclose (s); } /* Find the crtoffloadtable.o file in LIBRARY_PATH, make copy and pass name of -- 2.11.0
[PATCH] plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637)
Add missing dlclose() S >From d0926b84047f281a29dc51bbd0a4bdda01a5c63f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru <sylves...@debian.org> Date: Sun, 14 May 2017 11:28:38 +0200 Subject: [PATCH 4/5] 2017-05-14 Sylvestre Ledru <sylves...@debian.org> * plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637) --- gcc/plugin.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/plugin.c b/gcc/plugin.c index cfd6ef25036..903a197b78b 100644 --- a/gcc/plugin.c +++ b/gcc/plugin.c @@ -617,6 +617,7 @@ try_init_one_plugin (struct plugin_name_args *plugin) if ((err = dlerror ()) != NULL) { + dlclose(dl_handle); error ("cannot find %s in plugin %s\n%s", str_plugin_init_func_name, plugin->full_name, err); return false; @@ -625,10 +626,12 @@ try_init_one_plugin (struct plugin_name_args *plugin) /* Call the plugin-provided initialization routine with the arguments. */ if ((*plugin_init) (plugin, _version)) { + dlclose(dl_handle); error ("fail to initialize plugin %s", plugin->full_name); return false; } + dlclose(dl_handle); return true; } -- 2.11.0
[PATCH] objc-runtime-shared-support.c - Identical code for different branches
Hello, Now that Coverity is up and running, I am trying to fix some errors. Let's start a trivial one (same code in different branches) S >From 50248decd02bfac52ad64b64c972750489e2ffa0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru <sylves...@debian.org> Date: Sun, 14 May 2017 10:55:24 +0200 Subject: [PATCH 1/5] 2017-05-14 Sylvestre Ledru <sylves...@debian.org> * objc-runtime-shared-support.c (build_module_descriptor): Identical code for different branches (since 2012) CID 1406758 --- gcc/objc/objc-runtime-shared-support.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gcc/objc/objc-runtime-shared-support.c b/gcc/objc/objc-runtime-shared-support.c index 8d35d27c031..5ead87078c6 100644 --- a/gcc/objc/objc-runtime-shared-support.c +++ b/gcc/objc/objc-runtime-shared-support.c @@ -500,11 +500,7 @@ build_module_descriptor (long vers, tree attr) objc_finish_struct (objc_module_template, decls); /* Create an instance of "_objc_module". */ - UOBJC_MODULES_decl = start_var_decl (objc_module_template, - /* FIXME - why the conditional - if the symbol is the - same. */ - flag_next_runtime ? "_OBJC_Module" : "_OBJC_Module"); + UOBJC_MODULES_decl = start_var_decl (objc_module_template, "_OBJC_Module"); /* This is the root of the metadata for defined classes and categories, it is referenced by the runtime and, therefore, needed. */ -- 2.11.0
Re: [Patch] PR55189 enable -Wreturn-type by default
On 20/08/2014 00:02, Joseph S. Myers wrote: On Fri, 15 Aug 2014, Sylvestre Ledru wrote: It is indeed useless. I removed it. Thanks http://sylvestre.ledru.info/0001-Enable-warning-Wreturn-type-by-default.patch I don't think most of the testsuite changes in this patch should be needed, and we should be conservative about changing existing testcases because of the risk that it affects what they test. Most of the changes seem like they would only have been relevant for the previous version that enabled -Wmissing-return warnings by default. The change to gcc.dg/c90-impl-int-1.c is simply wrong - the specific point of that testcase is to test various cases of implicit int, so you can't add explicit int return types to it. You need, obviously, the new tests for how -W(no-)missing-return and -W(no-)return-type work and what the defaults are. Existing tests should only need to be changed if they do in fact fail with the compiler patch applied. Thanks for the feedback. I updated the patch (including the gcc.dg/c90-impl-int-1.c change): http://sylvestre.ledru.info/0001-Enable-warning-Wreturn-type-by-default.patch For information, the number of files modified by this commit dropped from 1298 to 818. Thanks, Sylvestre
Re: [Patch] PR55189 enable -Wreturn-type by default
On 14/08/2014 20:48, Manuel López-Ibáñez wrote: --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -693,6 +693,10 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_option.warn_line_truncation = value; break; +case OPT_Wmissing_return: + warn_missing_return = value; + break; + case OPT_Wrealloc_lhs: gfc_option.warn_realloc_lhs = value; break; The entry in c.opt says this is a C/C++ option, why you need this? It is indeed useless. I removed it. Thanks http://sylvestre.ledru.info/0001-Enable-warning-Wreturn-type-by-default.patch --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -472,7 +472,7 @@ C ObjC Var(warn_implicit_function_declaration) Init(-1) Warning LangEnabledBy(C Warn about implicit function declarations Wimplicit-int -C ObjC Var(warn_implicit_int) Warning LangEnabledBy(C ObjC,Wimplicit) +C ObjC Var(warn_implicit_int) Warning Warn when a declaration does not specify a type Wimport diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 5ae910c..3f2019a 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -3615,7 +3615,7 @@ This warning is enabled by @option{-Wall} in C++. @opindex Wimplicit-int @opindex Wno-implicit-int Warn when a declaration does not specify a type. -This warning is enabled by @option{-Wall}. +This warning is enabled by default. @item -Wimplicit-function-declaration @r{(C and Objective-C only)} @opindex Wimplicit-function-declaration Does this patch actually enables -Wimplicit-int by default? The default without Init() should be zero! And according to this: https://gcc.gnu.org/ml/gcc-patches/2014-06/msg01367.html we still want -Wno-implicit to disable -Wimplicit-int (and -Werror=implicit to set -Werror=implicit-int), so the LangEnabledBy() should stay. The documentation could say: This warning is enabled by default and it is also controlled by -Wimplicit. OK. I will go back on this once the first patch is committed. Thanks, Sylvestre Full changelog: gcc/c-family/ChangeLog: 2014-08-13 Sylvestre Ledru sylves...@debian.org * c.opt: Enable -Wreturn-type by default Add -Wmissing-return: Warn whenever control may reach end of non-void function gcc/ChangeLog: 2014-08-13 Sylvestre Ledru sylves...@debian.org * doc/invoke.texi: Document new flag -Wmissing-return Update -Wreturn-type * tree-cfg.c (pass_warn_function_return::execute): Introduce -Wreturn-type management libgomp/ChangeLog: 2014-08-13 Sylvestre Ledru sylves...@debian.org * testsuite/libgomp.c++/loop-2.C: Update the test with -Wreturn-type by default and -Wmissing-return * testsuite/libgomp.c++/loop-4.C: likewise * testsuite/libgomp.c++/parallel-1.C: likewise * testsuite/libgomp.c++/shared-1.C: likewise * testsuite/libgomp.c++/single-1.C: likewise * testsuite/libgomp.c++/single-2.C: likewise * testsuite/libgomp.c/omp-loop02.c: likewise * testsuite/libgomp.c/omp-parallel-for.c: likewise * testsuite/libgomp.c/omp-parallel-if.c: likewise * testsuite/libgomp.c/omp-single-1.c: likewise * testsuite/libgomp.c/omp-single-2.c: likewise * testsuite/libgomp.c/omp_matvec.c: likewise * testsuite/libgomp.c/omp_workshare3.c: likewise * testsuite/libgomp.c/omp_workshare4.c: likewise * testsuite/libgomp.c/pr30494.c (check): likewise * testsuite/libgomp.c/shared-1.c: likewise gcc/testsuite/ChangeLog: 2014-08-13 Sylvestre Ledru sylves...@debian.org * gcc.dg/Wmissing-return1.c: New test which tests the new behavior * gcc.dg/Wmissing-return2.c: New test which tests the new behavior * gcc.dg/Wmissing-return3.c: New test which tests the new behavior * gcc.dg/Wmissing-return4.c: New test which tests the new behavior * gcc.dg/Wmissing-return5.c: New test which tests the new behavior * c-c++-common/asan/no-redundant-instrumentation-2.c (main): Update the test with -Wreturn-type by default and -Wmissing-return * c-c++-common/cilk-plus/AN/decl-ptr-colon.c (int main): likewise * c-c++-common/cilk-plus/AN/parser_errors.c: likewise * c-c++-common/cilk-plus/AN/parser_errors2.c: likewise * c-c++-common/cilk-plus/AN/parser_errors3.c: likewise * c-c++-common/cilk-plus/AN/pr57457-2.c: likewise * c-c++-common/cilk-plus/AN/pr57541-2.c (void foo1): likewise (void foo2): likewise * c-c++-common/cilk-plus/AN/pr57541.c (int foo): likewise (int foo1): likewise * c-c++-common/cilk-plus/CK/pr60197.c: likewise * c-c++-common/cilk-plus/CK/spawn_in_return.c: likewise * c-c++-common/convert-vec-1.c: likewise * c-c++-common/dfp/call-by-value.c (int foo32): likewise (int foo64): likewise (int foo128): likewise * c-c++-common/pr36513-2.c (int main2): likewise * c-c++-common/pr36513.c (int main1): likewise * c-c++-common/pr43772.c: likewise * c-c++-common/pr49706-2.c (same): likewise
Re: [Patch] PR55189 enable -Wreturn-type by default
On 12/08/2014 19:48, Joseph S. Myers wrote: On Mon, 11 Aug 2014, Sylvestre Ledru wrote: The test Wmissing-return2.c only has one of the two warnings. But as per -Wreturn-type = Run both, and for backwards compatibility with the existing definition of -Wreturn-type, both warnings should appear for this test. Make sense. Thanks for the feedback and the help. Here it is: https://github.com/sylvestre/gcc/commit/089ffc9fb85034111b892ee10190dc12b5dbe551 Yes, those tests seem as I expect. So, here is the full commit now. Since the patch is 600k, I uploaded it here: http://sylvestre.ledru.info/0001-Enable-warning-Wreturn-type-by-default.patch Let me know when I can commit that. At the end of this mail, I also added the changelog for Enable -Wimplicit-int by default Patch: http://sylvestre.ledru.info/0002-Enable-Wimplicit-int-by-default.patch Let me know if you prefer a separate mail. Everything is on github if it helps: https://github.com/sylvestre/gcc gcc/c-family/ChangeLog: 2014-08-13 Sylvestre Ledru sylves...@debian.org * c.opt: Enable -Wreturn-type by default Add -Wmissing-return: Warn whenever control may reach end of non-void function gcc/ChangeLog: 2014-08-13 Sylvestre Ledru sylves...@debian.org * doc/invoke.texi: Document new flag -Wmissing-return Update -Wreturn-type * tree-cfg.c (pass_warn_function_return::execute): Introduce -Wreturn-type management gcc/fortran/ChangeLog: 2014-08-13 Sylvestre Ledru sylves...@debian.org * options.c (gfc_handle_option): Manage the new flag -Wmissing-return libgomp/ChangeLog: 2014-08-13 Sylvestre Ledru sylves...@debian.org * testsuite/libgomp.c++/loop-2.C: Update the test with -Wreturn-type by default and -Wmissing-return * testsuite/libgomp.c++/loop-4.C: likewise * testsuite/libgomp.c++/parallel-1.C: likewise * testsuite/libgomp.c++/shared-1.C: likewise * testsuite/libgomp.c++/single-1.C: likewise * testsuite/libgomp.c++/single-2.C: likewise * testsuite/libgomp.c/omp-loop02.c: likewise * testsuite/libgomp.c/omp-parallel-for.c: likewise * testsuite/libgomp.c/omp-parallel-if.c: likewise * testsuite/libgomp.c/omp-single-1.c: likewise * testsuite/libgomp.c/omp-single-2.c: likewise * testsuite/libgomp.c/omp_matvec.c: likewise * testsuite/libgomp.c/omp_workshare3.c: likewise * testsuite/libgomp.c/omp_workshare4.c: likewise * testsuite/libgomp.c/pr30494.c (check): likewise * testsuite/libgomp.c/shared-1.c: likewise gcc/testsuite/ChangeLog: 2014-08-13 Sylvestre Ledru sylves...@debian.org * gcc.dg/Wmissing-return1.c: New test which tests the new behavior * gcc.dg/Wmissing-return2.c: New test which tests the new behavior * gcc.dg/Wmissing-return3.c: New test which tests the new behavior * gcc.dg/Wmissing-return4.c: New test which tests the new behavior * gcc.dg/Wmissing-return5.c: New test which tests the new behavior * c-c++-common/asan/no-redundant-instrumentation-2.c (main): Update the test with -Wreturn-type by default and -Wmissing-return * c-c++-common/cilk-plus/AN/decl-ptr-colon.c (int main): likewise * c-c++-common/cilk-plus/AN/parser_errors.c: likewise * c-c++-common/cilk-plus/AN/parser_errors2.c: likewise * c-c++-common/cilk-plus/AN/parser_errors3.c: likewise * c-c++-common/cilk-plus/AN/pr57457-2.c: likewise * c-c++-common/cilk-plus/AN/pr57541-2.c (void foo1): likewise (void foo2): likewise * c-c++-common/cilk-plus/AN/pr57541.c (int foo): likewise (int foo1): likewise * c-c++-common/cilk-plus/CK/pr60197.c: likewise * c-c++-common/cilk-plus/CK/spawn_in_return.c: likewise * c-c++-common/convert-vec-1.c: likewise * c-c++-common/dfp/call-by-value.c (int foo32): likewise (int foo64): likewise (int foo128): likewise * c-c++-common/pr36513-2.c (int main2): likewise * c-c++-common/pr36513.c (int main1): likewise * c-c++-common/pr43772.c: likewise * c-c++-common/pr49706-2.c (same): likewise * c-c++-common/raw-string-3.c: likewise * c-c++-common/tm/pr54893.c: likewise * c-c++-common/tm/trxn-expr-2.c: likewise * c-c++-common/tsan/fd_pipe_race.c: likewise * c-c++-common/tsan/tls_race.c: likewise * c-c++-common/vector-1.c (int f): likewise * c-c++-common/vector-2.c (void f): likewise * g++.dg/abi/covariant2.C (struct c3): likewise (struct c7): likewise * g++.dg/abi/covariant3.C: likewise * g++.dg/abi/key2.C (int sub): likewise * g++.dg/abi/mangle7.C: likewise * g++.dg/bprob/g++-bprob-1.C (call_for): likewise * g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc: likewise * g++.dg/conversion/op1.C (class C): likewise (int fn): likewise * g++.dg/conversion/op6.C: likewise * g++.dg/cpp0x/access01.C: likewise * g++.dg/cpp0x/alias-decl-19.C: likewise * g++.dg/cpp0x/auto2.C (struct A): likewise * g++.dg/cpp0x/constexpr-defarg2.C: likewise
Re: [PATCH] Fix some typos
On 12/08/2014 19:38, Marc Glisse wrote: On Tue, 12 Aug 2014, Sylvestre Ledru wrote: The patch fixes some typos found by Lintian, the Debian static analyzer. Did you check them yourself? Sure (but I am not a native English speaker). We end up with these information which doesn't seem correct to me. Where do you see that? Sylvestre
[PATCH] Fix some typos
Hello The patch fixes some typos found by Lintian, the Debian static analyzer. (it is mainly the opportunity to test my commit permissions). Thanks, Sylvestre libstdc++-v3/ChangeLog: 2014-08-12 Sylvestre Ledru sylves...@debian.org * include/profile/impl/profiler_hash_func.h: Fix a typo gcc/fortran/ChangeLog: 2014-08-12 Sylvestre Ledru sylves...@debian.org * lang.opt: Fix a typo gcc/ChangeLog: 2014-08-12 Sylvestre Ledru sylves...@debian.org * ChangeLog-2007: Fix a typo * config/ia64/ia64.c: Likewise * lra-constraints.c: Likewise * tree-ssa-copyrename.c: Likewise * tree-ssa-loop-niter.c: Likewise libjava/classpath/ChangeLog: 2014-08-12 Sylvestre Ledru sylves...@debian.org * ChangeLog-2004: Fix a typo * ChangeLog-2007: Likewise * doc/cp-hacking.texinfo: Likewise * examples/gnu/classpath/examples/sound/AudioPlayerSample.java: Likewise * gnu/javax/print/ipp/attribute/job/JobDetailedStatusMessages.java: Likewise * gnu/javax/print/ipp/attribute/job/JobDocumentAccessErrors.java: Likewise * gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReader.java: Likewise * java/text/MessageFormat.java: Likewise * javax/print/ServiceUIFactory.java: Likewise * javax/print/URIException.java: Likewise * javax/print/attribute/package.html: Likewise * javax/print/attribute/standard/JobStateReasons.java: Likewise * javax/print/attribute/standard/PrinterInfo.java: Likewise * javax/print/attribute/standard/PrinterMessageFromOperator.java: Likewise * javax/print/attribute/standard/PrinterMoreInfoManufacturer.java: Likewise * javax/print/attribute/standard/PrinterStateReasons.java: Likewise * javax/print/package.html: Likewise * native/jni/gstreamer-peer/gstreamer_io_peer.c: Likewise * tools/external/asm/org/objectweb/asm/Label.java: Likewise * tools/external/asm/org/objectweb/asm/tree/ClassNode.java: Likewise gcc/ada/ChangeLog: 2014-08-12 Sylvestre Ledru sylves...@debian.org * 9drpc.adb: Fix a typo * s-interr.ads: Likewise * s-taskin.ads: Likewise * s-traces.ads: Likewise * sysdep.c: Likewise Index: gcc/ChangeLog-2007 === --- gcc/ChangeLog-2007 (révision 213848) +++ gcc/ChangeLog-2007 (copie de travail) @@ -18001,7 +18001,7 @@ (make_gcov_file_name): Do not generate long names if input_name is NULL. (output_lines): If merging results do not display graph, data and - runs informations. + runs information. Checking source file modification is done in find_source. * doc/gcov.texi: Append an s to sourcefile. Index: gcc/ada/9drpc.adb === --- gcc/ada/9drpc.adb (révision 213848) +++ gcc/ada/9drpc.adb (copie de travail) @@ -600,7 +600,7 @@ Header : aliased Params_Stream_Type (Header_Size); begin - -- For more informations, see above + -- For more information, see above -- Request = 0 as we are not waiting for a reply message -- Result length = 0 as we don't expect a result at all Index: gcc/ada/s-interr.ads === --- gcc/ada/s-interr.ads(révision 213848) +++ gcc/ada/s-interr.ads(copie de travail) @@ -192,7 +192,7 @@ -- On finalization, we need to restore the handlers that were installed -- before the elaboration of the PO, so we need to store these previous -- handlers. This is also done by Install_Handlers, the room for these - -- informations is provided by adding a discriminant which is the number + -- information is provided by adding a discriminant which is the number -- of Attach_Handler pragmas and an array of this size in the protection -- type, Static_Interrupt_Protection. Index: gcc/ada/s-taskin.ads === --- gcc/ada/s-taskin.ads(révision 213848) +++ gcc/ada/s-taskin.ads(copie de travail) @@ -671,7 +671,7 @@ -- Task_Info pragma. Analyzer : System.Stack_Usage.Stack_Analyzer; - -- For storing informations used to measure the stack usage + -- For storing information used to measure the stack usage Global_Task_Lock_Nesting : Natural; -- This is the current nesting level of calls to Index: gcc/ada/s-traces.ads === --- gcc/ada/s-traces.ads(révision 213848) +++ gcc/ada/s-traces.ads(copie de travail) @@ -34,17 +34,17 @@ -- Warning : NO dependencies to tasking should be created here -- This package, and all its children are used to implement debug --- informations +-- information -- A new primitive, Send_Trace_Info
Re: [Patch] PR55189 enable -Wreturn-type by default
On 12/08/2014 19:48, Joseph S. Myers wrote: On Mon, 11 Aug 2014, Sylvestre Ledru wrote: The test Wmissing-return2.c only has one of the two warnings. But as per -Wreturn-type = Run both, and for backwards compatibility with the existing definition of -Wreturn-type, both warnings should appear for this test. Make sense. Thanks for the feedback and the help. Here it is: https://github.com/sylvestre/gcc/commit/089ffc9fb85034111b892ee10190dc12b5dbe551 Yes, those tests seem as I expect. Thanks! By the way, do you prefer a single commit for all tests or one per directory (gfortran, C++, gcc, OpenMP) ? Each commit needs to avoid causing regressions. Thus, if a change to compiler behavior would cause an existing test to fail, the change to the test needs to be in the same commit as the change of behavior - or in a previous commit if the changed test works both with and without the compiler change. Since -Wreturn -Wmissing-return are tied, I will have to commit everything at once. I am going to send the patch asap (after an update + build + tests to make sure new tests pass). Sylvestre
Re: [Patch] PR55189 enable -Wreturn-type by default
On 31/07/2014 00:08, Joseph S. Myers wrote: On Mon, 7 Jul 2014, Sylvestre Ledru wrote: Hello, On 17/06/2014 19:41, Joseph S. Myers wrote: On Tue, 17 Jun 2014, Sylvestre Ledru wrote: OK. I will do that. We should test the following: * default = run just -Wreturn-type * -Wreturn-type = Run both * -Wreturn-type + -Wmissing-return = Run both * -Wno-return-type + -Wmissing-return = Run just the second one * -Wno-return-type + -Wno-missing-return = Run none Do you see any other? That looks like the right things to test, if there are no changes for anything other than those options. Here it is: https://github.com/sylvestre/gcc/commit/db8aaac91aa09fd1ec1cc8974586aec45a221e71 Is that what you expected? The test Wmissing-return2.c only has one of the two warnings. But as per -Wreturn-type = Run both, and for backwards compatibility with the existing definition of -Wreturn-type, both warnings should appear for this test. Make sense. Thanks for the feedback and the help. Here it is: https://github.com/sylvestre/gcc/commit/089ffc9fb85034111b892ee10190dc12b5dbe551 (It's simply that only a subset of -Wreturn-type seems suitable to enable by default for C. Maybe the default subset, -Wreturn-type -Wno-missing-return (which is a combination that should also be included in the testcases), should have its own option name, although I don't know what that would be.) What about implementing that in an further commit? I have touched more than 1200 test files and I would like to see that merged soon to avoid more conflicts. By the way, do you prefer a single commit for all tests or one per directory (gfortran, C++, gcc, OpenMP) ? Thanks Sylvestre
Re: [Patch] PR55189 enable -Wreturn-type by default
Joseph, ping :) (I know you were in holidays) S On 07/07/2014 19:17, Sylvestre Ledru wrote: Hello, On 17/06/2014 19:41, Joseph S. Myers wrote: On Tue, 17 Jun 2014, Sylvestre Ledru wrote: OK. I will do that. We should test the following: * default = run just -Wreturn-type * -Wreturn-type = Run both * -Wreturn-type + -Wmissing-return = Run both * -Wno-return-type + -Wmissing-return = Run just the second one * -Wno-return-type + -Wno-missing-return = Run none Do you see any other? That looks like the right things to test, if there are no changes for anything other than those options. Here it is: https://github.com/sylvestre/gcc/commit/db8aaac91aa09fd1ec1cc8974586aec45a221e71 Is that what you expected? Besides that, are you OK with my changes? (with the tests updated) The tests are key to reviewing whether the code changes actually do the right thing. Right. Thanks again for your help and comments, it is really appreciated, Sylvestre
Re: [Patch] PR55189 enable -Wreturn-type by default
Hello, On 17/06/2014 19:41, Joseph S. Myers wrote: On Tue, 17 Jun 2014, Sylvestre Ledru wrote: OK. I will do that. We should test the following: * default = run just -Wreturn-type * -Wreturn-type = Run both * -Wreturn-type + -Wmissing-return = Run both * -Wno-return-type + -Wmissing-return = Run just the second one * -Wno-return-type + -Wno-missing-return = Run none Do you see any other? That looks like the right things to test, if there are no changes for anything other than those options. Here it is: https://github.com/sylvestre/gcc/commit/db8aaac91aa09fd1ec1cc8974586aec45a221e71 Is that what you expected? Besides that, are you OK with my changes? (with the tests updated) The tests are key to reviewing whether the code changes actually do the right thing. Right. Thanks again for your help and comments, it is really appreciated, Sylvestre
Re: [Patch] PR55189 enable -Wreturn-type by default
On 05/06/2014 20:01, Joseph S. Myers wrote: Initially, I implemented -Wmissing-return to manage this case ( https://gcc.gnu.org/ml/gcc-patches/2014-01/msg00820.html ) but Jason suggested to remove that: https://gcc.gnu.org/ml/gcc-patches/2014-01/msg01033.html (I don't have a strong opinion on the subject). I think splitting the option like that makes sense. Compatibility indicates that -Wreturn-type and -Wall should still enable -Wmissing-return, but only the other pieces of -Wreturn-type should be enabled by default, at least for C. (Enabling -Wimplicit-int by default might be a good starting point.) OK. As attachment, you will find a potential implementation. Is that what you expect? Also, at least one testsuite change in your patch is wrong. OK. Thanks. I've probably made other (I update +1300 of them) Thanks Sylvestre From 1b936c618c58dc0e899fa9f56013de48f7e4dcd6 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru sylves...@debian.org Date: Tue, 17 Jun 2014 18:48:29 +0200 Subject: [PATCH 2/2] Enable Wimplicit by default --- gcc/c-family/c.opt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 050d400..9b9ede7 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -460,7 +460,7 @@ C ObjC Var(warn_implicit_function_declaration) Init(-1) Warning LangEnabledBy(C Warn about implicit function declarations Wimplicit-int -C ObjC Var(warn_implicit_int) Warning LangEnabledBy(C ObjC,Wimplicit) +C ObjC Var(warn_implicit_int) Warning Warn when a declaration does not specify a type Wimport -- 2.0.0 From 80cd3dff34f74058ab66b69e0e01a05eaf686338 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru sylves...@debian.org Date: Tue, 17 Jun 2014 18:48:12 +0200 Subject: [PATCH 1/2] Introduce -Wmissing-return (Was part of -Wreturn-type which is now enabled by default) --- gcc/c-family/c.opt| 4 gcc/doc/invoke.texi | 10 +- gcc/fortran/options.c | 4 gcc/tree-cfg.c| 4 ++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 91f8275..050d400 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -697,6 +697,10 @@ Wreturn-type C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Warn whenever a function's return type defaults to \int\ (C), or about inconsistent return types (C++) +Wmissing-return +C ObjC C++ ObjC++ Var(warn_missing_return) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) +Warn whenever control may reach end of non-void function + Wselector ObjC ObjC++ Var(warn_selector) Warning Warn if a selector has multiple methods diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 9a34f1c..9911e86 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -258,7 +258,7 @@ Objective-C and Objective-C++ Dialects}. -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol -Wmain -Wmaybe-uninitialized -Wmissing-braces -Wmissing-field-initializers @gol --Wmissing-include-dirs @gol +-Wmissing-include-dirs -Wmissing-return @gol -Wno-multichar -Wnonnull -Wno-overflow -Wopenmp-simd @gol -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol @@ -3327,6 +3327,7 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}. -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol -Wmaybe-uninitialized @gol -Wmissing-braces @r{(only for C/ObjC)} @gol +-Wmissing-return @gol -Wnonnull @gol -Wopenmp-simd @gol -Wparentheses @gol @@ -3657,6 +3658,13 @@ the following example, the initializer for @samp{a} is not fully bracketed, but that for @samp{b} is fully bracketed. This warning is enabled by @option{-Wall} in C. +@item -Wmissing-return +@opindex Wmissing-return +@opindex Wno-missing-return +Warn whenever falling off the end of the function body (I.e. without +any return). +This warning is enabled by @option{-Wall} for C and C++. + @smallexample int a[2][2] = @{ 0, 1, 2, 3 @}; int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index a2b91ca..fe71230 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -698,6 +698,10 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_option.warn_line_truncation = value; break; +case OPT_Wmissing_return: + warn_missing_return = value; + break; + case OPT_Wrealloc_lhs: gfc_option.warn_realloc_lhs = value; break; diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index e824619..2fd342e 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -8265,7 +8265,7 @@ pass_warn_function_return::execute (function *fun) /* If we see return; in some basic block, then we do reach the end without returning a value. */ - else if (warn_return_type + else
Re: [Patch] PR55189 enable -Wreturn-type by default
On 17/06/2014 19:15, Joseph S. Myers wrote: On Tue, 17 Jun 2014, Sylvestre Ledru wrote: On 05/06/2014 20:01, Joseph S. Myers wrote: Initially, I implemented -Wmissing-return to manage this case ( https://gcc.gnu.org/ml/gcc-patches/2014-01/msg00820.html ) but Jason suggested to remove that: https://gcc.gnu.org/ml/gcc-patches/2014-01/msg01033.html (I don't have a strong opinion on the subject). I think splitting the option like that makes sense. Compatibility indicates that -Wreturn-type and -Wall should still enable -Wmissing-return, but only the other pieces of -Wreturn-type should be enabled by default, at least for C. (Enabling -Wimplicit-int by default might be a good starting point.) OK. As attachment, you will find a potential implementation. Is that what you expect? It would help a lot if it included testcases for what various options / option combinations do / do not enable. OK. I will do that. We should test the following: * default = run just -Wreturn-type * -Wreturn-type = Run both * -Wreturn-type + -Wmissing-return = Run both * -Wno-return-type + -Wmissing-return = Run just the second one * -Wno-return-type + -Wno-missing-return = Run none Do you see any other? I expect that each option continues to enable the warnings it does at present (so if a user explicitly does -Wreturn-type it also enables the -Wmissing-return warnings, for example) - but some warnings would start to be enabled by default. If someone does e.g. -Wno-implicit that would disable the default -Wimplicit-int; if they do -Wno-implicit -Wimplicit that would have the same effect as just -Wimplicit (so keeping the default warnings enabled, and possibly enabling others). OK. I will try to implement that later (I don't think -Wimplicit-int is necessary to enable -Wreturn-type by default). Besides that, are you OK with my changes? (with the tests updated) Thanks, Sylvestre
Re: [Patch] PR55189 enable -Wreturn-type by default
On 05/06/2014 01:31, Joseph S. Myers wrote: On Wed, 4 Jun 2014, Sylvestre Ledru wrote: Hello, Finally, I have been able to update all tests with -Wreturn-type enabled by default. AFAIK, under GNU/Linux Debian Jessie 64 bits, there is no PASS-FAIL tests. Now, I would like to know if I can commit that into the repository. Who can review that? As attachment, you will find the actual (tiny) patch. I split the tests update by languages. As they are big ( 1260 files changed, 1638 insertions(+), 903 deletions(-) ), I uploaded the patches on my server: Some of those patches appear to be addressing cases where control appears to reach the end of a function returning non-void, as opposed to cases where the return type defaults to int. Do you have an example of the patches you are talking about? As I said in https://gcc.gnu.org/ml/gcc/2014-01/msg00207.html, I don't think that warning is appropriate to enable by default as it catches perfectly valid C90 / C99 code that avoids using extensions to annotate noreturn functions. I can try to implement that but I don't know where to start. Any clue? (I *do* think it's appropriate to enable by default the warning about return type defaulting to int - more generally, to enable -Wimplicit-int -Wimplicit-function-declaration - and the -Wreturn-type warning about a return statement without a value in a function returning non-void also seems appropriate to enable by default. I can try to enable them too by default. It seems my patches are covering most of the tests updates. Warning about the absence of any return statement in a function returning non-void is probably also a reasonable default warning from the -Wreturn-type set; it's specifically the flow-based warnings that can give false positives in the absence of noreturn annotations that I'm dubious about enabling by default.) You are talking about code like this one (from Jonathan Wakely) ? int f(int c) { if (c) return 0; function_that_never_returns(); } Initially, I implemented -Wmissing-return to manage this case ( https://gcc.gnu.org/ml/gcc-patches/2014-01/msg00820.html ) but Jason suggested to remove that: https://gcc.gnu.org/ml/gcc-patches/2014-01/msg01033.html (I don't have a strong opinion on the subject). Sylvestre
[Patch] PR55189 enable -Wreturn-type by default
Hello, Finally, I have been able to update all tests with -Wreturn-type enabled by default. AFAIK, under GNU/Linux Debian Jessie 64 bits, there is no PASS-FAIL tests. Now, I would like to know if I can commit that into the repository. Who can review that? As attachment, you will find the actual (tiny) patch. I split the tests update by languages. As they are big ( 1260 files changed, 1638 insertions(+), 903 deletions(-) ), I uploaded the patches on my server: http://sylvestre.ledru.info/bordel/patch/0002-Update-Objective-c-tests-with-warning-return-type-en.patch http://sylvestre.ledru.info/bordel/patch/0003-Update-Fortran-tests-with-warning-return-type-enable.patch http://sylvestre.ledru.info/bordel/patch/0004-Update-gcc-tests-with-warning-return-type-enabled-by.patch http://sylvestre.ledru.info/bordel/patch/0005-Update-C-tests-with-warning-return-type-enabled-by-d.patch http://sylvestre.ledru.info/bordel/patch/0006-Update-OpenMP-tests-with-warning-return-type-enabled.patch Thanks, Sylvestre gcc/c-family/ChangeLog: 2014-06-04 Sylvestre Ledru sylves...@debian.org * c.opt: -Wreturn-type enabled by default From 650edb9943ba8b2afb4995e70f671d8fdc26e10a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru sylves...@debian.org Date: Wed, 4 Jun 2014 13:33:40 +0200 Subject: [PATCH 1/6] Enable warning return-type by default --- gcc/c-family/c.opt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 5d36a80..8e78a9d 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -686,7 +686,7 @@ C ObjC C++ ObjC++ Var(warn_return_local_addr) Init(1) Warning Warn about returning a pointer/reference to a local or temporary variable. Wreturn-type -C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) +C ObjC C++ ObjC++ Var(warn_return_type) Init(1) Warning Warn whenever a function's return type defaults to \int\ (C), or about inconsistent return types (C++) Wselector -- 2.0.0
Re: [Patch] PR55189 enable -Wreturn-type by default
On 23/01/2014 10:48, Jason Merrill wrote: On 01/16/2014 02:44 PM, Jason Merrill wrote: To avoid spurious warnings on code with infinite loops we could add a simple check for infinite loops and suppress the warning in that case. Basically, if we see a loop with an always-true condition and no breaks. Like so: Tested x86_64-pc-linux-gnu, applying to trunk. Thanks for that! S
Re: [Patch] PR55189 enable -Wreturn-type by default
On 16/01/2014 11:44, Jason Merrill wrote: My preference would be to turn -Wreturn-type on by default, but not create the separate -Wmissing-return flag. As I argued in 2002, there should only be one flag. I don't have any opinion on the subject. The separate option or not is fine with me. I am just following an advice received :) Sylvestre
Enable -Wreturn-type by default ?
Hello, I would like to propose the activation by default of -Wreturn-type. The main objective would to provide a warning for such code: int foo() { return; } For now, it is only enabled when we have -Wall: $ gcc -c foo.c $ gcc -Wall -c foo.c foo.c: In function ‘foo’: foo.c:2:2: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type] I already wrote the patch but at lot of tests need to be updated to pass with this change. It is why, before starting updating all of them, I would like to know if there is a consensus here. This bug discuss about this: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55189 The idea seems to be accepted. Sylvestre