OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [fixincludes/] [fixlib.h] - Diff between revs 154 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 154 Rev 816
 
 
/* Install modified versions of certain ANSI-incompatible system header
/* Install modified versions of certain ANSI-incompatible system header
   files which are fixed to work correctly with ANSI C and placed in a
   files which are fixed to work correctly with ANSI C and placed in a
   directory that GCC will search.
   directory that GCC will search.
 
 
   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
   Free Software Foundation, Inc.
   Free Software Foundation, Inc.
 
 
This file is part of GCC.
This file is part of GCC.
 
 
GCC is free software; you can redistribute it and/or modify
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
any later version.
 
 
GCC is distributed in the hope that it will be useful,
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
GNU General Public License for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING.  If not, write to
along with GCC; see the file COPYING.  If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.  */
Boston, MA 02110-1301, USA.  */
 
 
#ifndef GCC_FIXLIB_H
#ifndef GCC_FIXLIB_H
#define GCC_FIXLIB_H
#define GCC_FIXLIB_H
 
 
#include "config.h"
#include "config.h"
#include "system.h"
#include "system.h"
#include <signal.h>
#include <signal.h>
 
 
#include "xregex.h"
#include "xregex.h"
#include "libiberty.h"
#include "libiberty.h"
 
 
#ifndef STDIN_FILENO
#ifndef STDIN_FILENO
# define STDIN_FILENO   0
# define STDIN_FILENO   0
#endif
#endif
#ifndef STDOUT_FILENO
#ifndef STDOUT_FILENO
# define STDOUT_FILENO  1
# define STDOUT_FILENO  1
#endif
#endif
 
 
#if ! defined( SIGCHLD ) && defined( SIGCLD )
#if ! defined( SIGCHLD ) && defined( SIGCLD )
#  define SIGCHLD SIGCLD
#  define SIGCHLD SIGCLD
#endif
#endif
 
 
#ifndef SIGQUIT
#ifndef SIGQUIT
#define SIGQUIT SIGTERM
#define SIGQUIT SIGTERM
#endif
#endif
#ifndef SIGIOT
#ifndef SIGIOT
#define SIGIOT SIGTERM
#define SIGIOT SIGTERM
#endif
#endif
#ifndef SIGPIPE
#ifndef SIGPIPE
#define SIGPIPE SIGTERM
#define SIGPIPE SIGTERM
#endif
#endif
#ifndef SIGALRM
#ifndef SIGALRM
#define SIGALRM SIGTERM
#define SIGALRM SIGTERM
#endif
#endif
#ifndef SIGKILL
#ifndef SIGKILL
#define SIGKILL SIGTERM
#define SIGKILL SIGTERM
#endif
#endif
 
 
typedef int t_success;
typedef int t_success;
 
 
#define FAILURE         (-1)
#define FAILURE         (-1)
#define SUCCESS           0
#define SUCCESS           0
#define PROBLEM           1
#define PROBLEM           1
 
 
#define SUCCEEDED(p)    ((p) == SUCCESS)
#define SUCCEEDED(p)    ((p) == SUCCESS)
#define SUCCESSFUL(p)   SUCCEEDED (p)
#define SUCCESSFUL(p)   SUCCEEDED (p)
#define FAILED(p)       ((p) < SUCCESS)
#define FAILED(p)       ((p) < SUCCESS)
#define HADGLITCH(p)    ((p) > SUCCESS)
#define HADGLITCH(p)    ((p) > SUCCESS)
 
 
#ifndef DEBUG
#ifndef DEBUG
# define STATIC static
# define STATIC static
#else
#else
# define STATIC
# define STATIC
#endif
#endif
 
 
#define tSCC static const char
#define tSCC static const char
#define tCC  const char
#define tCC  const char
#define tSC  static char
#define tSC  static char
 
 
/* If this particular system's header files define the macro `MAXPATHLEN',
/* If this particular system's header files define the macro `MAXPATHLEN',
   we happily take advantage of it; otherwise we use a value which ought
   we happily take advantage of it; otherwise we use a value which ought
   to be large enough.  */
   to be large enough.  */
#ifndef MAXPATHLEN
#ifndef MAXPATHLEN
# define MAXPATHLEN     4096
# define MAXPATHLEN     4096
#endif
#endif
 
 
#ifndef EXIT_SUCCESS
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# define EXIT_SUCCESS 0
#endif
#endif
#ifndef EXIT_FAILURE
#ifndef EXIT_FAILURE
# define EXIT_FAILURE 1
# define EXIT_FAILURE 1
#endif
#endif
 
 
#define EXIT_BROKEN  3
#define EXIT_BROKEN  3
 
 
#define NUL             '\0'
#define NUL             '\0'
 
 
#ifndef NOPROCESS
#ifndef NOPROCESS
#define NOPROCESS       ((pid_t) -1)
#define NOPROCESS       ((pid_t) -1)
#define NULLPROCESS     ((pid_t)0)
#define NULLPROCESS     ((pid_t)0)
 
 
#define EXIT_PANIC      99
#define EXIT_PANIC      99
#endif /* NOPROCESS */
#endif /* NOPROCESS */
 
 
#define IGNORE_ARG(a)   ((void)(a))
#define IGNORE_ARG(a)   ((void)(a))
 
 
typedef enum t_bool
typedef enum t_bool
{
{
  BOOL_FALSE, BOOL_TRUE
  BOOL_FALSE, BOOL_TRUE
} t_bool;
} t_bool;
 
 
typedef int apply_fix_p_t;  /* Apply Fix Predicate Type */
typedef int apply_fix_p_t;  /* Apply Fix Predicate Type */
 
 
#define APPLY_FIX 0
#define APPLY_FIX 0
#define SKIP_FIX  1
#define SKIP_FIX  1
 
 
#define ENV_TABLE                                    \
#define ENV_TABLE                                    \
  _ENV_( pz_machine,   BOOL_TRUE, "TARGET_MACHINE",  \
  _ENV_( pz_machine,   BOOL_TRUE, "TARGET_MACHINE",  \
         "output from config.guess" )                \
         "output from config.guess" )                \
                                                     \
                                                     \
  _ENV_( pz_orig_dir,  BOOL_TRUE, "ORIGDIR",         \
  _ENV_( pz_orig_dir,  BOOL_TRUE, "ORIGDIR",         \
         "directory of fixincl and applyfix" )       \
         "directory of fixincl and applyfix" )       \
                                                     \
                                                     \
  _ENV_( pz_src_dir,   BOOL_TRUE, "SRCDIR",          \
  _ENV_( pz_src_dir,   BOOL_TRUE, "SRCDIR",          \
         "directory of original files" )             \
         "directory of original files" )             \
                                                     \
                                                     \
  _ENV_( pz_input_dir, BOOL_TRUE, "INPUT",           \
  _ENV_( pz_input_dir, BOOL_TRUE, "INPUT",           \
         "current directory for fixincl" )           \
         "current directory for fixincl" )           \
                                                     \
                                                     \
  _ENV_( pz_dest_dir,  BOOL_TRUE, "DESTDIR",         \
  _ENV_( pz_dest_dir,  BOOL_TRUE, "DESTDIR",         \
         "output directory" )                        \
         "output directory" )                        \
                                                     \
                                                     \
  _ENV_( pz_mn_name_pat, BOOL_FALSE, "MN_NAME_PAT",  \
  _ENV_( pz_mn_name_pat, BOOL_FALSE, "MN_NAME_PAT",  \
         "regex matching forbidden identifiers" )    \
         "regex matching forbidden identifiers" )    \
                                                     \
                                                     \
  _ENV_( pz_verbose,  BOOL_FALSE, "VERBOSE",         \
  _ENV_( pz_verbose,  BOOL_FALSE, "VERBOSE",         \
         "amount of user entertainment" )            \
         "amount of user entertainment" )            \
                                                     \
                                                     \
  _ENV_( pz_find_base, BOOL_TRUE, "FIND_BASE",       \
  _ENV_( pz_find_base, BOOL_TRUE, "FIND_BASE",       \
         "leader to trim from file names" )
         "leader to trim from file names" )
 
 
#define _ENV_(v,m,n,t)   extern tCC* v;
#define _ENV_(v,m,n,t)   extern tCC* v;
ENV_TABLE
ENV_TABLE
#undef _ENV_
#undef _ENV_
 
 
/*  Test Descriptor
/*  Test Descriptor
 
 
    Each fix may have associated tests that determine
    Each fix may have associated tests that determine
    whether the fix needs to be applied or not.
    whether the fix needs to be applied or not.
    Each test has a type (from the te_test_type enumeration);
    Each test has a type (from the te_test_type enumeration);
    associated test text; and, if the test is TT_EGREP or
    associated test text; and, if the test is TT_EGREP or
    the negated form TT_NEGREP, a pointer to the compiled
    the negated form TT_NEGREP, a pointer to the compiled
    version of the text string.
    version of the text string.
 
 
    */
    */
typedef enum
typedef enum
{
{
  TT_TEST, TT_EGREP, TT_NEGREP, TT_FUNCTION
  TT_TEST, TT_EGREP, TT_NEGREP, TT_FUNCTION
} te_test_type;
} te_test_type;
 
 
typedef struct test_desc tTestDesc;
typedef struct test_desc tTestDesc;
 
 
struct test_desc
struct test_desc
{
{
  te_test_type type;
  te_test_type type;
  const char *pz_test_text;
  const char *pz_test_text;
  regex_t *p_test_regex;
  regex_t *p_test_regex;
};
};
 
 
typedef struct patch_desc tPatchDesc;
typedef struct patch_desc tPatchDesc;
 
 
/*  Fix Descriptor
/*  Fix Descriptor
 
 
    Everything you ever wanted to know about how to apply
    Everything you ever wanted to know about how to apply
    a particular fix (which files, how to qualify them,
    a particular fix (which files, how to qualify them,
    how to actually make the fix, etc...)
    how to actually make the fix, etc...)
 
 
    NB:  the FD_ defines are BIT FLAGS, even though
    NB:  the FD_ defines are BIT FLAGS, even though
         some are mutually exclusive
         some are mutually exclusive
 
 
    */
    */
#define FD_MACH_ONLY      0x0000
#define FD_MACH_ONLY      0x0000
#define FD_MACH_IFNOT     0x0001
#define FD_MACH_IFNOT     0x0001
#define FD_SHELL_SCRIPT   0x0002
#define FD_SHELL_SCRIPT   0x0002
#define FD_SUBROUTINE     0x0004
#define FD_SUBROUTINE     0x0004
#define FD_REPLACEMENT    0x0008
#define FD_REPLACEMENT    0x0008
#define FD_SKIP_TEST      0x8000
#define FD_SKIP_TEST      0x8000
 
 
typedef struct fix_desc tFixDesc;
typedef struct fix_desc tFixDesc;
struct fix_desc
struct fix_desc
{
{
  tCC*        fix_name;       /* Name of the fix */
  tCC*        fix_name;       /* Name of the fix */
  tCC*        file_list;      /* List of files it applies to */
  tCC*        file_list;      /* List of files it applies to */
  tCC**       papz_machs;     /* List of machine/os-es it applies to */
  tCC**       papz_machs;     /* List of machine/os-es it applies to */
  int         test_ct;
  int         test_ct;
  int         fd_flags;
  int         fd_flags;
  tTestDesc*  p_test_desc;
  tTestDesc*  p_test_desc;
  tCC**       patch_args;
  tCC**       patch_args;
  long        unused;
  long        unused;
};
};
 
 
typedef struct {
typedef struct {
  int         type_name_len;
  int         type_name_len;
  tCC*        pz_type;
  tCC*        pz_type;
  tCC*        pz_TYPE;
  tCC*        pz_TYPE;
  tCC*        pz_gtype;
  tCC*        pz_gtype;
} t_gnu_type_map;
} t_gnu_type_map;
 
 
extern int gnu_type_map_ct;
extern int gnu_type_map_ct;
 
 
#ifdef HAVE_MMAP_FILE
#ifdef HAVE_MMAP_FILE
#define UNLOAD_DATA() do { if (curr_data_mapped) { \
#define UNLOAD_DATA() do { if (curr_data_mapped) { \
  munmap ((void*)pz_curr_data, data_map_size); close (data_map_fd); } \
  munmap ((void*)pz_curr_data, data_map_size); close (data_map_fd); } \
  else free ((void*)pz_curr_data); } while(0)
  else free ((void*)pz_curr_data); } while(0)
#else
#else
#define UNLOAD_DATA() free ((void*)pz_curr_data)
#define UNLOAD_DATA() free ((void*)pz_curr_data)
#endif
#endif
 
 
/*
/*
 *  Exported procedures
 *  Exported procedures
 */
 */
char * load_file_data ( FILE* fp );
char * load_file_data ( FILE* fp );
 
 
#ifdef IS_CXX_HEADER_NEEDED
#ifdef IS_CXX_HEADER_NEEDED
t_bool is_cxx_header ( tCC* filename, tCC* filetext );
t_bool is_cxx_header ( tCC* filename, tCC* filetext );
#endif /* IS_CXX_HEADER_NEEDED */
#endif /* IS_CXX_HEADER_NEEDED */
 
 
#ifdef SKIP_QUOTE_NEEDED
#ifdef SKIP_QUOTE_NEEDED
tCC*   skip_quote ( char  q, char* text );
tCC*   skip_quote ( char  q, char* text );
#endif
#endif
 
 
void   compile_re ( tCC* pat, regex_t* re, int match, tCC *e1, tCC *e2 );
void   compile_re ( tCC* pat, regex_t* re, int match, tCC *e1, tCC *e2 );
 
 
void   apply_fix ( tFixDesc* p_fixd, tCC* filname );
void   apply_fix ( tFixDesc* p_fixd, tCC* filname );
apply_fix_p_t
apply_fix_p_t
       run_test ( tCC* t_name, tCC* f_name, tCC* text );
       run_test ( tCC* t_name, tCC* f_name, tCC* text );
 
 
#ifdef SEPARATE_FIX_PROC
#ifdef SEPARATE_FIX_PROC
char*  make_raw_shell_str ( char* pz_d, tCC* pz_s, size_t smax );
char*  make_raw_shell_str ( char* pz_d, tCC* pz_s, size_t smax );
#endif
#endif
 
 
t_bool mn_get_regexps ( regex_t** label_re, regex_t** name_re, tCC *who );
t_bool mn_get_regexps ( regex_t** label_re, regex_t** name_re, tCC *who );
 
 
void   initialize_opts ( void );
void   initialize_opts ( void );
#endif /* ! GCC_FIXLIB_H */
#endif /* ! GCC_FIXLIB_H */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.