This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: %D
> config/i386/winnt.c
> config/i386/winnt.c: In function `ix86_handle_dll_attribute':
> config/i386/winnt.c:110: warning: unknown conversion type character `D' in format
> config/i386/winnt.c:110: warning: too many arguments for format
The %D specifier (which takes a tree argument) is only valid in the C
and C++ frontends. Since winnt.c is a backend file (and is used by
all languages) we shouldn't use %D there and gcc is warning you about
this.
If it is actually the case that the routines containing these %D uses
are somehow only called by the C and/or C++ frontends, then you
probably need to isolate the routines into a file that is only linked
with cc1 and/or cc1plus. To do that you need to:
1. Move the problematic code into a file called winnt-c.c.
2. In addition to whatever other includes you need based on the code
demands, also include c-tree.h or cp/cp-tree.h (before toplev.h),
this allows the format specifiers from that frontend to be used
without warnings. Alternatively you can define GCC_DIAG_STYLE to
__gcc_cdiag__ or __gcc_cxxdiag__ (before toplev.h).
3. Set the `c_target_objs' and/or `cxx_target_objs' variables equal
to winnt-c.o in config.gcc for all targets using winnt.o so that
winnt-c.o gets linked with just those frontends.
That should be it.
--Kaveh
PS: a "quick hack" to test if this will fix things would be to instead
define GCC_DIAG_STYLE appropriately at the top of winnt.c (before
including toplev.h) and see if it clears up the problem.
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu
- References:
- %D
- From: Robert McNulty Junior