Blame SOURCES/patch.mcpp.2.7.2

086f3f
diff -r -c -N ../mcpp-2.7.2-old/noconfig/vc2010.dif ./noconfig/vc2010.dif
086f3f
*** ../mcpp-2.7.2-old/noconfig/vc2010.dif	Wed Dec 31 20:30:00 1969
086f3f
--- ./noconfig/vc2010.dif	Fri May 14 12:47:22 2010
086f3f
***************
086f3f
*** 0 ****
086f3f
--- 1,67 ----
086f3f
+ *** noconfig.H	Thu Sep 25 15:34:56 2008
086f3f
+ --- noconfig.H.vc2005	Thu Sep 25 17:23:49 2008
086f3f
+ ***************
086f3f
+ *** 15,21 ****
086f3f
+    */
086f3f
+   
086f3f
+   /* Define target operating-system.  */
086f3f
+ ! #define SYSTEM              SYS_FREEBSD
086f3f
+   
086f3f
+   /* Define target compiler.          */
086f3f
+   #ifndef COMPILER
086f3f
+ --- 15,21 ----
086f3f
+    */
086f3f
+   
086f3f
+   /* Define target operating-system.  */
086f3f
+ ! #define SYSTEM              SYS_WIN32
086f3f
+   
086f3f
+   /* Define target compiler.          */
086f3f
+   #ifndef COMPILER
086f3f
+ ***************
086f3f
+ *** 26,36 ****
086f3f
+   #define HOST_SYSTEM         SYSTEM
086f3f
+   
086f3f
+   /* Define host compiler.            */
086f3f
+ ! #define HOST_COMPILER       GNUC
086f3f
+   
086f3f
+   /* Version message.                 */
086f3f
+   /* "MCPP V.2.* (200y/mm) compiled by " precedes VERSION_MSG */
086f3f
+ ! #define VERSION_MSG         "GCC 3.4"
086f3f
+   #if     0
086f3f
+       "LCC-Win32 2006-03"
086f3f
+       "Visual C 2005"
086f3f
+ --- 26,36 ----
086f3f
+   #define HOST_SYSTEM         SYSTEM
086f3f
+   
086f3f
+   /* Define host compiler.            */
086f3f
+ ! #define HOST_COMPILER       MSC
086f3f
+   
086f3f
+   /* Version message.                 */
086f3f
+   /* "MCPP V.2.* (200y/mm) compiled by " precedes VERSION_MSG */
086f3f
+ ! #define VERSION_MSG         "Visual C 2010"
086f3f
+   #if     0
086f3f
+       "LCC-Win32 2006-03"
086f3f
+       "Visual C 2005"
086f3f
+ ***************
086f3f
+ *** 212,221 ****
086f3f
+   #define ONE_PASS            TRUE
086f3f
+   #endif
086f3f
+   #define COMPILER_EXT        "_MSC_VER"
086f3f
+ ! #define COMPILER_EXT_VAL    "1500"      /* VC 6.0: "1200"   */
086f3f
+       /* VC 2002: "1300", VC 2003: "1310", VC 2005: "1400", VC 2008: "1500"   */
086f3f
+   #define COMPILER_EXT2       "_MSC_FULL_VER"
086f3f
+ ! #define COMPILER_EXT2_VAL   "150021022" /* VC 6.0: "12008804"       */
086f3f
+       /* VC 2002: "13009466", VC 2003: "13103077", VC 2005: "140050320"       */
086f3f
+       /* VC 2008: "150021022" */
086f3f
+   #define COMPILER_SP1        "_MSC_EXTENSIONS"
086f3f
+ --- 212,221 ----
086f3f
+   #define ONE_PASS            TRUE
086f3f
+   #endif
086f3f
+   #define COMPILER_EXT        "_MSC_VER"
086f3f
+ ! #define COMPILER_EXT_VAL    "1600"      /* VC 6.0: "1200"   */
086f3f
+       /* VC 2002: "1300", VC 2003: "1310", VC 2005: "1400", VC 2008: "1500"   */
086f3f
+   #define COMPILER_EXT2       "_MSC_FULL_VER"
086f3f
+ ! #define COMPILER_EXT2_VAL   "160030319" /* VC 6.0: "12008804"       */
086f3f
+       /* VC 2002: "13009466", VC 2003: "13103077", VC 2005: "140050320"       */
086f3f
+       /* VC 2008: "150021022" */
086f3f
+   #define COMPILER_SP1        "_MSC_EXTENSIONS"
086f3f
diff -r -c -N ../mcpp-2.7.2-old/src/internal.H ./src/internal.H
086f3f
*** ../mcpp-2.7.2-old/src/internal.H	Wed Aug 27 10:31:16 2008
086f3f
--- ./src/internal.H	Fri May 14 12:40:56 2010
086f3f
***************
086f3f
*** 390,395 ****
086f3f
--- 390,397 ----
086f3f
  extern char     identifier[];       /* Lastly scanned name          */
086f3f
  extern IFINFO   ifstack[];          /* Information of #if nesting   */
086f3f
  extern char     work_buf[];
086f3f
+ extern FILEINFO * sh_file;
086f3f
+ extern int      sh_line;
086f3f
          /* Temporary buffer for directive line and macro expansion  */
086f3f
  
086f3f
  /* main.c   */
086f3f
***************
086f3f
*** 557,562 ****
086f3f
  #endif
086f3f
  #endif
086f3f
  
086f3f
! #if HOST_HAVE_STPCPY
086f3f
  extern char *   stpcpy( char * dest, const char * src);
086f3f
  #endif
086f3f
--- 559,564 ----
086f3f
  #endif
086f3f
  #endif
086f3f
  
086f3f
! #if HOST_HAVE_STPCPY && !defined(stpcpy)
086f3f
  extern char *   stpcpy( char * dest, const char * src);
086f3f
  #endif
086f3f
diff -r -c -N ../mcpp-2.7.2-old/src/main.c ./src/main.c
086f3f
*** ../mcpp-2.7.2-old/src/main.c	Wed Nov  5 05:04:46 2008
086f3f
--- ./src/main.c	Fri May 14 12:40:56 2010
086f3f
***************
086f3f
*** 326,331 ****
086f3f
--- 326,333 ----
086f3f
              = FALSE;
086f3f
      option_flags.trig = TRIGRAPHS_INIT;
086f3f
      option_flags.dig = DIGRAPHS_INIT;
086f3f
+     sh_file = NULL;
086f3f
+     sh_line = 0;
086f3f
  }
086f3f
  
086f3f
  int     mcpp_lib_main
086f3f
diff -r -c -N ../mcpp-2.7.2-old/src/support.c ./src/support.c
086f3f
*** ../mcpp-2.7.2-old/src/support.c	Tue Jun 10 06:02:33 2008
086f3f
--- ./src/support.c	Fri May 14 12:40:56 2010
086f3f
***************
086f3f
*** 188,194 ****
086f3f
      size_t      length
086f3f
  )
086f3f
  {
086f3f
!     if (mem_buf_p->bytes_avail < length) {  /* Need to allocate more memory */
086f3f
          size_t size = MAX( BUF_INCR_SIZE, length);
086f3f
  
086f3f
          if (mem_buf_p->buffer == NULL) {            /* 1st append   */
086f3f
--- 188,194 ----
086f3f
      size_t      length
086f3f
  )
086f3f
  {
086f3f
!     if (mem_buf_p->bytes_avail < length + 1) {  /* Need to allocate more memory */
086f3f
          size_t size = MAX( BUF_INCR_SIZE, length);
086f3f
  
086f3f
          if (mem_buf_p->buffer == NULL) {            /* 1st append   */
086f3f
***************
086f3f
*** 1722,1727 ****
086f3f
--- 1722,1729 ----
086f3f
                      sp -= 2;
086f3f
                      while (*sp != '\n')     /* Until end of line    */
086f3f
                          mcpp_fputc( *sp++, OUT);
086f3f
+                     mcpp_fputc( '\n', OUT);
086f3f
+                     wrong_line = TRUE;
086f3f
                  }
086f3f
                  goto  end_line;
086f3f
              default:                        /* Not a comment        */
086f3f
diff -r -c -N ../mcpp-2.7.2-old/src/system.c ./src/system.c
086f3f
*** ../mcpp-2.7.2-old/src/system.c      2008-11-26 10:53:51.000000000 +0100
086f3f
--- ./src/system.c      2011-02-21 16:18:05.678058106 +0100
086f3f
***************
086f3f
*** 3534,3539 ****
086f3f
--- 3534,3565 ----
086f3f
      FILEINFO *      file;
086f3f
      const char *    too_many_include_nest =
086f3f
              "More than %.0s%ld nesting of #include";    /* _F_ _W4_ */
086f3f
+             
086f3f
+     //
086f3f
+     // When encoding is UTF-8, skip BOM if present.
086f3f
+     //
086f3f
+     if(mbchar == UTF8 && fp != NULL && ftell(fp) == 0)
086f3f
+     {
086f3f
+         const unsigned char UTF8_BOM[3] = {0xEF, 0xBB, 0xBF};
086f3f
+         unsigned char FILE_HEAD[3] = {0, 0, 0};
086f3f
+         int i;
086f3f
+         for(i = 0; i < 3; ++i)
086f3f
+         {
086f3f
+             FILE_HEAD[i] = getc(fp);
086f3f
+             if(FILE_HEAD[i] != UTF8_BOM[i])
086f3f
+             {
086f3f
+                 if(FILE_HEAD[i] == (unsigned char)EOF)
086f3f
+                 {
086f3f
+                     i--;
086f3f
+                 }
086f3f
+                 for(; i >= 0; --i)
086f3f
+                 {
086f3f
+                     ungetc(FILE_HEAD[i], fp);
086f3f
+                 }
086f3f
+                 break;
086f3f
+             }
086f3f
+         }
086f3f
+     }
086f3f
  
086f3f
      filename = set_fname( filename);    /* Search or append to fnamelist[]  */
086f3f
      fullname = set_fname( fullname);    /* Search or append to fnamelist[]  */
086f3f
***************
086f3f
*** 3858,3863 ****
086f3f
--- 3884,3892 ----
086f3f
  }
086f3f
  #endif
086f3f
  
086f3f
+ FILEINFO*       sh_file;
086f3f
+ int             sh_line;
086f3f
+ 
086f3f
  void    sharp(
086f3f
      FILEINFO *  sharp_file,
086f3f
      int         flag        /* Flag to append to the line for GCC   */
086f3f
***************
086f3f
*** 3868,3875 ****
086f3f
   * else (i.e. 'sharp_file' is NULL) 'infile'.
086f3f
   */
086f3f
  {
086f3f
-     static FILEINFO *   sh_file;
086f3f
-     static int  sh_line;
086f3f
      FILEINFO *  file;
086f3f
      int         line;
086f3f
  
086f3f
--- 3897,3902 ----