Skip to content

Commit

Permalink
Update ZeroC/Ice patch to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
Sdrkun committed Dec 25, 2020
1 parent 2d739a8 commit b7f33ad
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 4 deletions.
67 changes: 67 additions & 0 deletions noconfig/vc2010.dif
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
*** noconfig.H Thu Sep 25 15:34:56 2008
--- noconfig.H.vc2005 Thu Sep 25 17:23:49 2008
***************
*** 15,21 ****
*/

/* Define target operating-system. */
! #define SYSTEM SYS_FREEBSD

/* Define target compiler. */
#ifndef COMPILER
--- 15,21 ----
*/

/* Define target operating-system. */
! #define SYSTEM SYS_WIN32

/* Define target compiler. */
#ifndef COMPILER
***************
*** 26,36 ****
#define HOST_SYSTEM SYSTEM

/* Define host compiler. */
! #define HOST_COMPILER GNUC

/* Version message. */
/* "MCPP V.2.* (200y/mm) compiled by " precedes VERSION_MSG */
! #define VERSION_MSG "GCC 3.4"
#if 0
"LCC-Win32 2006-03"
"Visual C 2005"
--- 26,36 ----
#define HOST_SYSTEM SYSTEM

/* Define host compiler. */
! #define HOST_COMPILER MSC

/* Version message. */
/* "MCPP V.2.* (200y/mm) compiled by " precedes VERSION_MSG */
! #define VERSION_MSG "Visual C 2010"
#if 0
"LCC-Win32 2006-03"
"Visual C 2005"
***************
*** 212,221 ****
#define ONE_PASS TRUE
#endif
#define COMPILER_EXT "_MSC_VER"
! #define COMPILER_EXT_VAL "1500" /* VC 6.0: "1200" */
/* VC 2002: "1300", VC 2003: "1310", VC 2005: "1400", VC 2008: "1500" */
#define COMPILER_EXT2 "_MSC_FULL_VER"
! #define COMPILER_EXT2_VAL "150021022" /* VC 6.0: "12008804" */
/* VC 2002: "13009466", VC 2003: "13103077", VC 2005: "140050320" */
/* VC 2008: "150021022" */
#define COMPILER_SP1 "_MSC_EXTENSIONS"
--- 212,221 ----
#define ONE_PASS TRUE
#endif
#define COMPILER_EXT "_MSC_VER"
! #define COMPILER_EXT_VAL "1600" /* VC 6.0: "1200" */
/* VC 2002: "1300", VC 2003: "1310", VC 2005: "1400", VC 2008: "1500" */
#define COMPILER_EXT2 "_MSC_FULL_VER"
! #define COMPILER_EXT2_VAL "160030319" /* VC 6.0: "12008804" */
/* VC 2002: "13009466", VC 2003: "13103077", VC 2005: "140050320" */
/* VC 2008: "150021022" */
#define COMPILER_SP1 "_MSC_EXTENSIONS"
4 changes: 3 additions & 1 deletion src/internal.H
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ extern char * const work_end; /* End of work[] buffer */
extern char identifier[]; /* Lastly scanned name */
extern IFINFO ifstack[]; /* Information of #if nesting */
extern char work_buf[];
extern FILEINFO * sh_file;
extern int sh_line;
/* Temporary buffer for directive line and macro expansion */

/* main.c */
Expand Down Expand Up @@ -557,6 +559,6 @@ extern void init_system( void);
#endif
#endif

#if HOST_HAVE_STPCPY
#if HOST_HAVE_STPCPY && !defined(stpcpy)
extern char * stpcpy( char * dest, const char * src);
#endif
2 changes: 2 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ static void init_main( void)
= FALSE;
option_flags.trig = TRIGRAPHS_INIT;
option_flags.dig = DIGRAPHS_INIT;
sh_file = NULL;
sh_line = 0;
}

int mcpp_lib_main
Expand Down
4 changes: 3 additions & 1 deletion src/support.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static char * append_to_buffer(
size_t length
)
{
if (mem_buf_p->bytes_avail < length) { /* Need to allocate more memory */
if (mem_buf_p->bytes_avail < length + 1) { /* Need to allocate more memory */
size_t size = MAX( BUF_INCR_SIZE, length);

if (mem_buf_p->buffer == NULL) { /* 1st append */
Expand Down Expand Up @@ -1722,6 +1722,8 @@ static char * parse_line( void)
sp -= 2;
while (*sp != '\n') /* Until end of line */
mcpp_fputc( *sp++, OUT);
mcpp_fputc( '\n', OUT);
wrong_line = TRUE;
}
goto end_line;
default: /* Not a comment */
Expand Down
31 changes: 29 additions & 2 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -3534,6 +3534,32 @@ void add_file(
FILEINFO * file;
const char * too_many_include_nest =
"More than %.0s%ld nesting of #include"; /* _F_ _W4_ */

//
// When encoding is UTF-8, skip BOM if present.
//
if(mbchar == UTF8 && fp != NULL && ftell(fp) == 0)
{
const unsigned char UTF8_BOM[3] = {0xEF, 0xBB, 0xBF};
unsigned char FILE_HEAD[3] = {0, 0, 0};
int i;
for(i = 0; i < 3; ++i)
{
FILE_HEAD[i] = getc(fp);
if(FILE_HEAD[i] != UTF8_BOM[i])
{
if(FILE_HEAD[i] == (unsigned char)EOF)
{
i--;
}
for(; i >= 0; --i)
{
ungetc(FILE_HEAD[i], fp);
}
break;
}
}
}

filename = set_fname( filename); /* Search or append to fnamelist[] */
fullname = set_fname( fullname); /* Search or append to fnamelist[] */
Expand Down Expand Up @@ -3858,6 +3884,9 @@ static int chk_dirp(
}
#endif

FILEINFO* sh_file;
int sh_line;

void sharp(
FILEINFO * sharp_file,
int flag /* Flag to append to the line for GCC */
Expand All @@ -3868,8 +3897,6 @@ void sharp(
* else (i.e. 'sharp_file' is NULL) 'infile'.
*/
{
static FILEINFO * sh_file;
static int sh_line;
FILEINFO * file;
int line;

Expand Down

0 comments on commit b7f33ad

Please sign in to comment.