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]

getenv related patch installed



This fixes some problems  which arise when non-path environment variables
are passed through cygwin's GET_ENVIRONMENT macro.


gcc/ChangeLog:

Tue Sep 15 22:22:18 1998  Felix Lee  <flee@cygnus.com>

	* c-lex.c (init_lex): Use getenv("LANG"), not GET_ENVIRONMENT().
	* cccp.c (main): ditto

	* cccp.c, collect2.c, cpplib.c, gcc.c, config/i386/xm-cygwin32.h:
	rename GET_ENVIRONMENT to GET_ENV_PATH_LIST, and fix some
	macro-use bugs.

gcc/cp/ChangeLog:

1998-09-15  Felix Lee  <flee@cygnus.com>

	* lex.c (init_parse): Use getenv("LANG"), not GET_ENVIRONMENT().

Index: c-lex.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/./gcc/c-lex.c,v
retrieving revision 1.30
diff -c -3 -p -r1.30 c-lex.c
*** c-lex.c	1998/09/09 22:02:02	1.30
--- c-lex.c	1998/09/21 07:47:42
*************** Boston, MA 02111-1307, USA.  */
*** 36,45 ****
  #ifdef MULTIBYTE_CHARS
  #include "mbchar.h"
  #include <locale.h>
- 
- #ifndef GET_ENVIRONMENT
- #define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ((ENV_VALUE) = getenv (ENV_NAME))
- #endif
  #endif /* MULTIBYTE_CHARS */
  
  #if USE_CPPLIB
--- 36,41 ----
*************** init_lex ()
*** 230,236 ****
  #ifdef MULTIBYTE_CHARS
    /* Change to the native locale for multibyte conversions.  */
    setlocale (LC_CTYPE, "");
!   GET_ENVIRONMENT (literal_codeset, "LANG");
  #endif
  
    maxtoken = 40;
--- 226,232 ----
  #ifdef MULTIBYTE_CHARS
    /* Change to the native locale for multibyte conversions.  */
    setlocale (LC_CTYPE, "");
!   literal_codeset = getenv ("LANG");
  #endif
  
    maxtoken = 40;
Index: cccp.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/./gcc/cccp.c,v
retrieving revision 1.34
diff -c -3 -p -r1.34 cccp.c
*** cccp.c	1998/09/16 13:51:42	1.34
--- cccp.c	1998/09/21 07:47:56
*************** typedef unsigned char U_CHAR;
*** 45,52 ****
  #include <locale.h>
  #endif /* MULTIBYTE_CHARS */
  
! #ifndef GET_ENVIRONMENT
! #define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ENV_VALUE = getenv (ENV_NAME)
  #endif
  
  #ifndef STANDARD_INCLUDE_DIR
--- 45,52 ----
  #include <locale.h>
  #endif /* MULTIBYTE_CHARS */
  
! #ifndef GET_ENV_PATH_LIST
! #define GET_ENV_PATH_LIST(VAR,NAME)	do { (VAR) = getenv (NAME); } while (0)
  #endif
  
  #ifndef STANDARD_INCLUDE_DIR
*************** main (argc, argv)
*** 1310,1316 ****
  #ifdef MULTIBYTE_CHARS
    /* Change to the native locale for multibyte conversions.  */
    setlocale (LC_CTYPE, "");
!   GET_ENVIRONMENT (literal_codeset, "LANG");
  #endif
  
    /* Process switches and find input file name.  */
--- 1310,1316 ----
  #ifdef MULTIBYTE_CHARS
    /* Change to the native locale for multibyte conversions.  */
    setlocale (LC_CTYPE, "");
!   literal_codeset = getenv ("LANG");
  #endif
  
    /* Process switches and find input file name.  */
*************** main (argc, argv)
*** 1742,1748 ****
    /* Some people say that CPATH should replace the standard include dirs,
       but that seems pointless: it comes before them, so it overrides them
       anyway.  */
!   GET_ENVIRONMENT (cp, "CPATH");
    if (cp && ! no_standard_includes)
      path_include (cp);
  
--- 1742,1748 ----
    /* Some people say that CPATH should replace the standard include dirs,
       but that seems pointless: it comes before them, so it overrides them
       anyway.  */
!   GET_ENV_PATH_LIST (cp, "CPATH");
    if (cp && ! no_standard_includes)
      path_include (cp);
  
*************** main (argc, argv)
*** 1926,1941 ****
      switch ((objc << 1) + cplusplus)
        {
        case 0:
! 	GET_ENVIRONMENT (epath, "C_INCLUDE_PATH");
  	break;
        case 1:
! 	GET_ENVIRONMENT (epath, "CPLUS_INCLUDE_PATH");
  	break;
        case 2:
! 	GET_ENVIRONMENT (epath, "OBJC_INCLUDE_PATH");
  	break;
        case 3:
! 	GET_ENVIRONMENT (epath, "OBJCPLUS_INCLUDE_PATH");
  	break;
        }
      /* If the environment var for this language is set,
--- 1926,1941 ----
      switch ((objc << 1) + cplusplus)
        {
        case 0:
! 	GET_ENV_PATH_LIST (epath, "C_INCLUDE_PATH");
  	break;
        case 1:
! 	GET_ENV_PATH_LIST (epath, "CPLUS_INCLUDE_PATH");
  	break;
        case 2:
! 	GET_ENV_PATH_LIST (epath, "OBJC_INCLUDE_PATH");
  	break;
        case 3:
! 	GET_ENV_PATH_LIST (epath, "OBJCPLUS_INCLUDE_PATH");
  	break;
        }
      /* If the environment var for this language is set,
Index: collect2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/./gcc/collect2.c,v
retrieving revision 1.42
diff -c -3 -p -r1.42 collect2.c
*** collect2.c	1998/09/13 06:17:25	1.42
--- collect2.c	1998/09/21 07:48:00
*************** extern int prepends_underscore;
*** 233,240 ****
  
  extern FILE *fdopen ();
  
! #ifndef GET_ENVIRONMENT
! #define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ENV_VALUE = getenv (ENV_NAME)
  #endif
  
  /* Structure to hold all the directories in which to search for files to
--- 233,240 ----
  
  extern FILE *fdopen ();
  
! #ifndef GET_ENV_PATH_LIST
! #define GET_ENV_PATH_LIST(VAR,NAME)	do { (VAR) = getenv (NAME); } while (0)
  #endif
  
  /* Structure to hold all the directories in which to search for files to
*************** prefix_from_env (env, pprefix)
*** 862,868 ****
       struct path_prefix *pprefix;
  {
    char *p;
!   GET_ENVIRONMENT (p, env);
  
    if (p)
      prefix_from_string (p, pprefix);
--- 862,868 ----
       struct path_prefix *pprefix;
  {
    char *p;
!   GET_ENV_PATH_LIST (p, env);
  
    if (p)
      prefix_from_string (p, pprefix);
Index: cpplib.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/./gcc/cpplib.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 cpplib.c
*** cpplib.c	1998/09/16 13:51:41	1.31
--- cpplib.c	1998/09/21 07:48:12
*************** Foundation, 59 Temple Place - Suite 330,
*** 39,46 ****
  #include "cpplib.h"
  #include "cpphash.h"
  
! #ifndef GET_ENVIRONMENT
! #define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ENV_VALUE = getenv (ENV_NAME)
  #endif
  
  extern char *update_path PARAMS ((char *, char *));
--- 39,46 ----
  #include "cpplib.h"
  #include "cpphash.h"
  
! #ifndef GET_ENV_PATH_LIST
! #define GET_ENV_PATH_LIST(VAR,NAME)	do { (VAR) = getenv (NAME); } while (0)
  #endif
  
  extern char *update_path PARAMS ((char *, char *));
*************** cpp_start_read (pfile, fname)
*** 5710,5716 ****
    /* Some people say that CPATH should replace the standard include dirs,
       but that seems pointless: it comes before them, so it overrides them
       anyway.  */
!   GET_ENVIRONMENT (p, "CPATH");
    if (p != 0 && ! opts->no_standard_includes)
      path_include (pfile, p);
  
--- 5710,5716 ----
    /* Some people say that CPATH should replace the standard include dirs,
       but that seems pointless: it comes before them, so it overrides them
       anyway.  */
!   GET_ENV_PATH_LIST (p, "CPATH");
    if (p != 0 && ! opts->no_standard_includes)
      path_include (pfile, p);
  
*************** cpp_start_read (pfile, fname)
*** 5840,5855 ****
      switch ((opts->objc << 1) + opts->cplusplus)
        {
        case 0:
! 	GET_ENVIRONMENT (epath, "C_INCLUDE_PATH");
  	break;
        case 1:
! 	GET_ENVIRONMENT (epath, "CPLUS_INCLUDE_PATH");
  	break;
        case 2:
! 	GET_ENVIRONMENT (epath, "OBJC_INCLUDE_PATH");
  	break;
        case 3:
! 	GET_ENVIRONMENT (epath, "OBJCPLUS_INCLUDE_PATH");
  	break;
        }
      /* If the environment var for this language is set,
--- 5840,5855 ----
      switch ((opts->objc << 1) + opts->cplusplus)
        {
        case 0:
! 	GET_ENV_PATH_LIST (epath, "C_INCLUDE_PATH");
  	break;
        case 1:
! 	GET_ENV_PATH_LIST (epath, "CPLUS_INCLUDE_PATH");
  	break;
        case 2:
! 	GET_ENV_PATH_LIST (epath, "OBJC_INCLUDE_PATH");
  	break;
        case 3:
! 	GET_ENV_PATH_LIST (epath, "OBJCPLUS_INCLUDE_PATH");
  	break;
        }
      /* If the environment var for this language is set,
Index: gcc.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/./gcc/gcc.c,v
retrieving revision 1.55
diff -c -3 -p -r1.55 gcc.c
*** gcc.c	1998/09/20 23:54:09	1.55
--- gcc.c	1998/09/21 07:48:19
*************** static char dir_separator_str[] = {DIR_S
*** 111,118 ****
  #define obstack_chunk_alloc xmalloc
  #define obstack_chunk_free free
  
! #ifndef GET_ENVIRONMENT
! #define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ENV_VALUE = getenv (ENV_NAME)
  #endif
  
  extern char *my_strerror PROTO((int));
--- 111,118 ----
  #define obstack_chunk_alloc xmalloc
  #define obstack_chunk_free free
  
! #ifndef GET_ENV_PATH_LIST
! #define GET_ENV_PATH_LIST(VAR,NAME)	do { (VAR) = getenv (NAME); } while (0)
  #endif
  
  extern char *my_strerror PROTO((int));
*************** process_command (argc, argv)
*** 2563,2569 ****
    int have_o = 0;
    int lang_n_infiles = 0;
  
!   GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX");
  
    n_switches = 0;
    n_infiles = 0;
--- 2563,2569 ----
    int have_o = 0;
    int lang_n_infiles = 0;
  
!   GET_ENV_PATH_LIST (gcc_exec_prefix, "GCC_EXEC_PREFIX");
  
    n_switches = 0;
    n_infiles = 0;
*************** process_command (argc, argv)
*** 2606,2612 ****
    /* COMPILER_PATH and LIBRARY_PATH have values
       that are lists of directory names with colons.  */
  
!   GET_ENVIRONMENT (temp, "COMPILER_PATH");
    if (temp)
      {
        char *startp, *endp;
--- 2606,2612 ----
    /* COMPILER_PATH and LIBRARY_PATH have values
       that are lists of directory names with colons.  */
  
!   GET_ENV_PATH_LIST (temp, "COMPILER_PATH");
    if (temp)
      {
        char *startp, *endp;
*************** process_command (argc, argv)
*** 2640,2646 ****
  	}
      }
  
!   GET_ENVIRONMENT (temp, "LIBRARY_PATH");
    if (temp && *cross_compile == '0')
      {
        char *startp, *endp;
--- 2640,2646 ----
  	}
      }
  
!   GET_ENV_PATH_LIST (temp, "LIBRARY_PATH");
    if (temp && *cross_compile == '0')
      {
        char *startp, *endp;
*************** process_command (argc, argv)
*** 2673,2679 ****
      }
  
    /* Use LPATH like LIBRARY_PATH (for the CMU build program).  */
!   GET_ENVIRONMENT (temp, "LPATH");
    if (temp && *cross_compile == '0')
      {
        char *startp, *endp;
--- 2673,2679 ----
      }
  
    /* Use LPATH like LIBRARY_PATH (for the CMU build program).  */
!   GET_ENV_PATH_LIST (temp, "LPATH");
    if (temp && *cross_compile == '0')
      {
        char *startp, *endp;
Index: config/i386/xm-cygwin32.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/./gcc/config/i386/xm-cygwin32.h,v
retrieving revision 1.10
diff -c -3 -p -r1.10 xm-cygwin32.h
*** xm-cygwin32.h	1998/05/05 23:17:41	1.10
--- xm-cygwin32.h	1998/09/21 07:48:19
*************** Boston, MA 02111-1307, USA. */
*** 32,53 ****
  
  /* If we allow both '/' and '\' as dir separators, then
     allow both unix and win32 PATH syntax */
! #undef GET_ENVIRONMENT
! #define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME)                   \
! {                                                             \
!   char *epath;                                                \
!   char *win32epath;                                           \
!                                                               \
!   epath = win32epath = getenv (ENV_NAME);                     \
!   /* if we have a posix path list, convert to win32 path list */ \
!   if (epath != NULL && *epath != 0 && cygwin32_posix_path_list_p (epath)) \
!     {                                                         \
!       win32epath = (char *) xmalloc                           \
!       (cygwin32_posix_to_win32_path_list_buf_size (epath));   \
!       cygwin32_posix_to_win32_path_list (epath, win32epath);  \
!     }                                                         \
!    ENV_VALUE = win32epath;                                    \
! }
  
  #define PATH_SEPARATOR ';'
  
--- 32,53 ----
  
  /* If we allow both '/' and '\' as dir separators, then
     allow both unix and win32 PATH syntax */
! #undef GET_ENV_PATH_LIST
! #define GET_ENV_PATH_LIST(VAR,NAME)					\
! do {									\
!   char *_epath;								\
!   char *_win32epath;							\
!   _epath = _win32epath = getenv (NAME);					\
!   /* if we have a posix path list, convert to win32 path list */	\
!   if (_epath != NULL && *_epath != 0					\
!       && cygwin32_posix_path_list_p (_epath))				\
!     {									\
!       _win32epath = (char *) xmalloc					\
! 	(cygwin32_posix_to_win32_path_list_buf_size (_epath));		\
!       cygwin32_posix_to_win32_path_list (_epath, _win32epath);		\
!     }									\
!   (VAR) = _win32epath;							\
! } while (0)
  
  #define PATH_SEPARATOR ';'
  
Index: cp/lex.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/./gcc/cp/lex.c,v
retrieving revision 1.74
diff -c -3 -p -r1.74 lex.c
*** lex.c	1998/09/07 14:25:12	1.74
--- lex.c	1998/09/21 07:48:25
*************** Boston, MA 02111-1307, USA.  */
*** 42,51 ****
  #ifdef MULTIBYTE_CHARS
  #include "mbchar.h"
  #include <locale.h>
- 
- #ifndef GET_ENVIRONMENT
- #define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ((ENV_VALUE) = getenv (ENV_NAME))
- #endif
  #endif
  
  #define obstack_chunk_alloc xmalloc
--- 42,47 ----
*************** init_parse (filename)
*** 475,481 ****
  #ifdef MULTIBYTE_CHARS
    /* Change to the native locale for multibyte conversions.  */
    setlocale (LC_CTYPE, "");
!   GET_ENVIRONMENT (literal_codeset, "LANG");
  #endif
  
  #if USE_CPPLIB
--- 471,477 ----
  #ifdef MULTIBYTE_CHARS
    /* Change to the native locale for multibyte conversions.  */
    setlocale (LC_CTYPE, "");
!   literal_codeset = getenv ("LANG");
  #endif
  
  #if USE_CPPLIB





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