This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: How to properly determin _G_HAVE_PRINTF_FP in cross environs




>In searching the archives I saw this came up several times but I didn't
>find a solution provided.  I have a work around, I'd like pointers to
>the correct solution.

>When building a cross toolset (target=vxworks host=FreeBSD but I
>believe only target=vxworks is the problem) libio/gen-params
>improperly decides that there is a printf.h because the cross ld
>leaves programs relocateable and gen-params determines there 
>is a printf.h by cross-compiling this and not getting an error for an
>undefined symbol:
>
>> int main() { return __printf_fp (); }

  I mentioned this in the message at:

http://gcc.gnu.org/ml/gcc/2001-02/msg00294.html

which also contains a couple of pointers to other threads on the same
topic.  This one has been around for a while; general concensus seems to
be to work around it with a constant definition rather than try and
do proper detection.

>Now for my workaround.
>
>I put a test into gen-params similar to the one for HAVE_BOOL a few
>lines earlier:
>
>> if test -n "${HAVE_PRINTF_FP}" ; then
>>  echo "#define ${macro_prefix}HAVE_PRINTF_FP ${HAVE_PRINTF_FP}"
>>  echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO ${HAVE_PRINTF_FP}"
>> else
>(do the existing test)
>> fi
>
>then I set HAVE_PRINTF_FP to 1 in the environment which is obviously
>wrong.

  This is pretty much the same solution that Uli Drepper came up with 
in http://gcc.gnu.org/ml/gcc-patches/1999-09n/msg01197.html, although
he actually provided a new target-fragment to contain the definitions.

  My solution was to turn the 'undefined function' warning into an error
with -Wimplicit -Werror added to the compiler invocation in the bit of
code (do the existing test).

  So why do you set it to 1 in the environment when there isn't any 
printf_fp function in VxWorks?

     DaveK
-- 
 All your base are belong to us!


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]