This is the mail archive of the gcc-bugs@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]

new fixinclude problem on HP-UX


In gcc_ss_2000_03_13, fixinclude exposes a problem that was not present in
2.95.2.

The symptom on HP-UX 10.20 is that the bootstrap fails near the end of stage 1
when xgcc-compiling libgcc2.c, due to unterminated conditionals in the "fixed"
version of <limits.h>, ./include/syslimits.h.

The system header file /usr/include/limits.h on this platforms contains code
like this (note the multi-line comment starting on the macro definition line,
which is not treated as a unit by fixinclude, but which seems to confuse it):

================================================================
#  if !defined (_AES_SOURCE) && !defined (_XPG4)
#     ifndef DBL_MIN
#       define DBL_MIN   2.2250738585072014e-308   /* Min decimal value of a 
                                                        double */
#     endif /* DBL_MIN */

#     ifndef FLT_MIN 
#       define FLT_MIN   ((float)1.17549435e-38) /* Min decimal value of a float */
#     endif /* FLT_MIN */
#  endif  /* !defined (_AES_SOURCE) && !defined (_XPG4) */
================================================================

which is translated into the following in include/syslimits.h:

================================================================
#  if !defined (_AES_SOURCE) && !defined (_XPG4)
#     ifndef DBL_MIN
#ifndef DBL_MIN
#       define DBL_MIN   2.2250738585072014e-308   /* Min decimal value of a 
#endif
                                                        double */
#ifndef DBL_MIN
#     endif /* DBL_MIN */
#endif

#ifndef FLT_MIN
#     ifndef FLT_MIN 
#endif
#ifndef FLT_MIN
#       define FLT_MIN   ((float)1.17549435e-38) /* Min decimal value of a float */
#endif
#ifndef FLT_MIN
#     endif /* FLT_MIN */
#endif
#  endif  /* !defined (_AES_SOURCE) && !defined (_XPG4) */
================================================================

{The comment /* Min decimal value of a float */ appears on one line in both
files, even if some mailer might have split it on the way to you. -mf}

Note that fixinclude inserts the `#endif' within the comment, so that it has
no effect, leading to the "unterminated conditional" error correctly diagnosed
by xgcc.  (The construct may have a different meaning for a traditional
preprocessor, where comments are discarded later, but then the original,
unfixed header has an unintended meaning anyway.)

Note also the 3 apparent attempts by fixinclude to issue conditional
directives conditionally (as indicated by the discrepancy between indentation
levels and actual nesting of conditionals).  This may or may not cause
additional problems, but it seems inherently unsafe.

GCC 2.95.2's fixinclude decided that there was nothing to be fixed in the
original system header <limits.h> and installed a file containing only:

================================================================
/* syslimits.h stands for the system's own limits.h file.
   If we can use it ok unmodified, then we install this text.
   If fixincludes fixes it, then the fixed version is installed
   instead of this text.  */

#define _GCC_NEXT_LIMITS_H              /* tell gcc's limits.h to recurse */
#include_next <limits.h>
#undef _GCC_NEXT_LIMITS_H
================================================================

-- Marco
{as this email is not directed to any individual in particular, the
confidentiality clause appended by the company mail gateway does not apply}

-----------------------------------------------------------------
This email is confidential and intended solely for the use of the
individual to whom it is addressed.
Any views or opinions presented are solely those of the author
and do not necessarily represent those of Thyron Limited.
If you are not the intended recipient then please be advised
that you have received this email in error and that any use,
dissemination, forwarding, printing or copying of this email 
is strictly prohibited.
If you have received this email in error, please notify the 
Thyron IT Administrator on +44 (0)1923 236 050 or 
send an email to mail-admin@thyron.com.
Thank You

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