This is the mail archive of the gcc-patches@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: libg++/curses fix for OSR5 committed.


Bruce Korb wrote:

> This is different than the "fixinc.wrap" approach.  That approach is to
> #define "bool" for the duration of processing the file "curses.h"
> and then "#include_next" the original.  That approach will *fail* if
> there are other fixes that need to be applied to "curses.h" because
> it uses a fixed-contentent wrapper file that would displace any other
> applied fixes.  This approach merely disables #define-d and typedef-ed
> remappings of "bool" for __cplusplus compiles.

 Um, even worse.  The fixinc.sco fix has a bug.  Please note the name of
the "#include_next"-ed file.  You must remove the single quotes on the
here-doc EOF marker and parameterize the file name:

# This fix has the regex modified from the from fixinc.wrap
# Avoid the definition of the bool type in the following files when using
# g++, since it's now an official type in the C++ language.
for file in term.h tinfo.h
do
  if [ -r $INPUT/$file ]; then
    echo Checking $INPUT/$file
    w='[  ]'
    if grep "typedef$w.*char$w.*bool$w*;" $INPUT/$file >/dev/null
    then
      echo Fixed $file
      rm -f $LIB/$file
      cat <<'__EOF__' >$LIB/$file
#ifndef _CURSES_H_WRAPPER
#ifdef __cplusplus
# define bool __curses_bool_t
#endif
#include_next <curses.h>
#ifdef __cplusplus
# undef bool
#endif
#define _CURSES_H_WRAPPER
#endif /* _CURSES_H_WRAPPER */
__EOF__
      # Define _CURSES_H_WRAPPER at the end of the wrapper, not the start,
      # so that if #include_next gets another instance of the wrapper,
      # this will follow the #include_next chain until we arrive at
      # the real <curses.h>.
      chmod a+r $LIB/$file
    fi
  fi
done


--
Bruce Korb                      | Data Design Systems, Inc.
Korbb at DataDesign dot com     | 45 Cabot Dr., Suite 110
Voice:  408-260-0280            | Santa Clara,  CA   95051
Fax:    408-260-0281            | USA





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