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@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
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@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to