Jason Edgecombe <[email protected]> writes:

> I'm also getting compilation errors on Ubuntu 12.04 (Precise):
> make[3]: Entering directory
> /home/jwedgeco/openafs/openafs-git/openafs/src/opr'
> gcc -O -Wall -Wstrict-prototypes -Wold-style-definition -Werror
> -fdiagnostics-show-option -Wpointer-arith
> -I/home/jwedgeco/openafs/openafs-git/openafs/src/config
> -I/home/jwedgeco/openafs/openafs-git/openafs/include -I. -I. -pthread
> -D_REENTRANT -DAFS_PTHREAD_ENV -fPIC -o uuid.o -c uuid.c
> uuid.c: In function ‘opr_uuid_toString’:
> uuid.c:73:12: error: ignoring return value of ‘asprintf’, declared with
> attribute warn_unused_result [-Werror=unused-result]
> cc1: all warnings being treated as errors

Ubuntu enables -D_FORTIFY_SOURCE=2 by default in their version of gcc,
which enables the glibc annotations that allow unused-result to work with
standard library functions.  It would probably be a good idea to define
that unconditionally so that we get the same warnings on Debian, etc.

FWIW, the current set of warning flags that I use for other projects is:

# A set of flags for warnings.  Add -O because gcc won't find some warnings
# without optimization turned on.  Desirable warnings that can't be turned
# on due to other problems:
#
#     -Wconversion      http://bugs.debian.org/488884 (htons warnings)
#
# Last checked against gcc 4.6.1 (2011-05-04).  -D_FORTIFY_SOURCE=2 enables
# warn_unused_result attribute markings on glibc functions on Linux, which
# catches a few more issues.
WARNINGS = -g -O -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wendif-labels           \
        -Wformat=2 -Winit-self -Wswitch-enum -Wdeclaration-after-statement  \
        -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align           \
        -Wwrite-strings -Wjump-misses-init -Wlogical-op -Wstrict-prototypes \
        -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Werror

Some of those will require a newer gcc than 4.4, though, and some of them
won't be desireable for OpenAFS's current organization.

-- 
Russ Allbery ([email protected])             <http://www.eyrie.org/~eagle/>
_______________________________________________
OpenAFS-devel mailing list
[email protected]
https://lists.openafs.org/mailman/listinfo/openafs-devel

Reply via email to