Re: F40 proposal: Porting Fedora to Modern C (System-Wide Change proposal)

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

 



On Wed, Oct 26, 2022 at 02:18:02PM +0200, Milan Crha wrote:
> When I try to compile this simple program:
> 
>   #include <db.h>
>   int main(void) { db_create(NULL, NULL, 0); return 0; }
> 
> (which is part of the project's "can build" test to verify the thing is
> properly installed in the system) using:
> 
>    gcc -Wall -Wextra test.c -o test -ldb
> 
> then it doesn't claim anything and succeeds, but when I compile it as:
> 
>    gcc -std=c99 -Wall -Wextra test.c -o test -ldb

Note that in an earlier message in this thread replying to my
question, Florian pointed out that using -std is not actually
the way to test this.

All the -std options that exist in GCC today allow the undesired
behaviour to be used. So don't try to set '-std' at all, unless
you want todo that for other reasons.

For this particular proposal, what's needed is to set warning
flags:

  -Werror=implicit-int
  -Werror=implicit-function-declaration
  -Werror=int-conversion
  -Werror=strict-prototypes
  -Werror=old-style-definition


> I get an error:
> 
>    In file included from test.c:1:
>    /usr/include/db.h:1098:9: error: unknown type name ‘u_int’
> 
> and tons of related warning/error lines generated by gcc.

GCC in Fedora today actually defaults to -std=gnu18, so apps
are already getting the modern C standard out of the box,
unless they gave an explikcit -std arg themselves.

The reason for your problem in this particular example is that
you requested 'c99' rather than 'gnu99', so you disabled various
GCC extensions to the c99 standard, which the code appears to
rely on.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
_______________________________________________
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