The following are some ideas for C front-end projects to work on.
Warn about statements that are undefined because the order of evaluation of increment operators makes a big difference. Here is an example:
*foo++ = hack (*foo);
-Wsequence-point does some of this, but not that
The new version of the C standard (ISO/IEC 9899:1999) requires a number of library changes; these have to be provided by the C library, and not by gcc. In addition, there are also changes to the language proper, and some compiler support is needed for the new library features. An overview of the C99 implementation status is available.
Design and implement builtin functions that assist in implementing
the ISO C99
<tgmath.h> macros. These builtins
could be along the general lines of the macros used in glibc 2.2 (for
example, the implementation of
<tgmath.h> might use
__builtin_tgmath_unary_real_only (value, log2f, log2,
log2l) to implement the
log2 macro), but should be
designed so that, if the Annex G imaginary types are implemented in
GCC, glibc does not need to change again to allow for them. This
means additional functions, beyond those corresponding to the macros
in glibc, are needed to handle the trigonometric functions which G.7
specifies have real or imaginary result type for imaginary arguments,
but which have complex result type for complex arguments. The design
for these builtins should be discussed with the gcc and libc-alpha
strftime: warnings for use of
_flags without width on formats where inappropriate. Similar warnings where use of one format feature is useless unless another one is also used also apply for
-flags when no width is specified and so there is no padding) and for
printfformats: warn for integer constant argument out of range of unpromoted type (including signed/unsigned where it doesn't fit in range).
char. This may require changes elsewhere in the compiler to mark string constants with this information.
%q: anything more accurate than
long long? See messages 1 and 2 about this to gcc-bugs. (Note that
%qis now largely obsolete given the new C99 formats and macros.)
TORTURE_OPTIONS, by making changes elsewhere in the test harness so that
TORTURE_OPTIONSis initialized for each
dg-initrather than just once and so needing saving and restoring.
format_argattribute is applied to a function with a non-prototype declaration, and the function is later redeclared with a prototype or defined, the attribute should be checked again to see if it makes sense given the argument types of the function. Similarly, these checks should be made if the original attribute is on an old-style function definition.
__attribute__((__nonnull__)), such as for functions such as
NULL-terminated argument lists.
sprintfinto fixed length buffer if the output can't be proved not to overrun. Similarly for
%[...]without width to fixed length buffer (or possibly to any buffer); or
%cwith width to too short a buffer, including
freopen: warning for the incorrect format of the mode parameter, see PR c/5127. Some ideas for how to implement such a warning were discussed here.
Copyright (C) Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.