Re: Update on the Modern C initiative

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 05, 2023 at 04:38:55AM +0100, Kevin Kofler via devel wrote:
> Florian Weimer wrote:
> > The final patches for GCC 14 are currently under upstream review and
> > should land very soon.  Earlier, I had received feedback that the larger
> > community desires just one transition, so we end up with the following
> > warnings which turn into errors by default:
> > 
> >   -Wimplicit-function-declaration
> >   -Wimplicit-int
> >   -Wint-conversion
> >   -Wreturn-mismatch (new, previously part of -Wreturn-types)
> >   -Wdeclaration-missing-parameter-type (new, previously unnamed)
> >   -Wincompatible-pointer-types
> > 
> > Only the first two were covered in the initial Fedora conversion work.
> 
> As much as I understand the point of -Werror=implicit-function-declaration 
> (since implicit function declarations can cause several subtle bugs), and 
> implicit int is obscure enough for its removal to not be a big problem (even 
> though its potential for causing bugs is much lower), as much I have to 
> wonder about the others. Especially the incompatible pointer types sound 
> more like nitpicking than actual bugs (though I guess strict aliasing can 
> cause issues with those, but then I would expect to see -Wstrict-aliasing 
> warnings).

Look at the gimp case, where a function prototype was expecting double *
argument but caller was calling it with address of float.
void foo (double *);
void
bar ()
{
  float f = 5.0f;
  foo (&f);
}
While this resulted in a warning even without -Wall, clearly nobody noticed
until this was made an error:
file-tiff-load.c:1372:56: warning: passing argument 2 of ‘gimp_image_get_resolution’ from incompatible pointer type [-Wincompatible-pointer-types]
 1372 |                     gimp_image_get_resolution (*image, &xres, &yres);
      |                                                        ^~~~~
      |                                                        |
      |                                                        gfloat * {aka float *}
In file included from ../../libgimp/gimp_pdb_headers.h:55,
                 from ../../libgimp/gimp.h:66,
                 from file-tiff-load.c:52:
../../libgimp/gimpimage_pdb.h:179:86: note: expected ‘gdouble *’ {aka ‘double *’} but argument is of type ‘gfloat *’ {aka ‘float *’}
  179 |                                                                 gdouble             *xresolution,
      |                                                                 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
file-tiff-load.c:1372:63: warning: passing argument 3 of ‘gimp_image_get_resolution’ from incompatible pointer type [-Wincompatible-pointer-types]
 1372 |                     gimp_image_get_resolution (*image, &xres, &yres);
      |                                                               ^~~~~
      |                                                               |
      |                                                               gfloat * {aka float *}
../../libgimp/gimpimage_pdb.h:180:86: note: expected ‘gdouble *’ {aka ‘double *’} but argument is of type ‘gfloat *’ {aka ‘float *’}
  180 |                                                                 gdouble             *yresolution);
      |                                                                 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

	Jakub
--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux