Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.197
 
1.198
 
MAIN:ragge:20110814150702
 
cc.c
_>140140 char *copy(const char *, int);
 141141 char *cat(const char *, const char *);
 142142 char *setsuf(char *, char);
<> 143+int cxxsuf(char *);
143144 int getsuf(char *);
<> 145+char *getsufp(char *s);
144146 int main(int, char *[]);
 145147 void error(char *, ...);
 146148 void errorx(int, char *, ...);
     
 !
195197 int     nostdinc, nostdlib;
 196198 int     onlyas;
 197199 int     pthreads;
<>198 -int     xcflag, xgcc;
  200+int     xcflag, xgnu89, xgnu99;
199201 int     ascpp;
 200202 #ifdef CHAR_UNSIGNED
 201203 int     funsigned_char = 1;
 202204 #else
 203205 int     funsigned_char = 0;
 204206 #endif
<> 207+int     cxxflag;
205208 
 206209 char    *passp = LIBEXECDIR PREPROCESSOR;
 207210 char    *pass0 = LIBEXECDIR COMPILER;
<> 211+char    *passxx0 = LIBEXECDIR "c++com";
208212 char    *as = ASSEMBLER;
 209213 char    *ld = LINKER;
 210214 char    *sysroot;
     
 !
258262 char *altincdir = INCLUDEDIR "pcc/";
 259263 char *libdir = LIBDIR;
 260264 char *pccincdir = PCCINCDIR;
<> 265+char *pxxincdir = PCCINCDIR "/c++";
261266 char *pcclibdir = PCCLIBDIR;
 262267 #ifdef mach_amd64
 263268 int amd64_i386;
     
 !
360365         int k;
 361366 #endif
 362367 
<> 368+        if (strcmp(argv[0], "p++") == 0) {
  369+                cxxflag = 1;
  370+                pass0 = passxx0;
  371+        }
  372+
363373 #ifdef WIN32
 364374         /* have to prefix path early.  -B may override */
 365375         incdir = win32pathsubst(incdir);
     
 !
637647                                         xcflag = 1; /* default */
 638648                                 else if (strcmp(t, "assembler-with-cpp") == 0)
 639649                                         ascpp = 1;
<>640 -#ifdef notyet
641650                                 else if (strcmp(t, "c++") == 0)
 642651                                         cxxflag++;
<>643 -#endif
644652                                 else
 645653                                         xlist[xnum++] = argv[i];
 646654                                 break;
     
 !
736744                                         llist[nl++] = "-Bsymbolic";
 737745                                 } else if (strncmp(argv[i], "-std", 4) == 0) {
 738746                                         if (strcmp(&argv[i][5], "gnu99") == 0 ||
<>739 -                                            strcmp(&argv[i][5], "gnu9x") == 0 ||
 740 -                                            strcmp(&argv[i][5], "gnu89") == 0)
 741 -                                                xgcc = 1;
  747+                                            strcmp(&argv[i][5], "gnu9x") == 0)
  748+                                                xgnu99 = 1;
  749+                                        if (strcmp(&argv[i][5], "gnu89") == 0)
  750+                                                xgnu89 = 1;
742751                                 } else
 743752                                         goto passa;
 744753                                 break;
     
 !
748757                         t = argv[i];
 749758                         if (*argv[i] == '-' && argv[i][1] == 'L')
 750759                                 ;
<>751 -                        else if((c=getsuf(t))=='c' || c=='S' || c=='i' ||
  760+                        else if ((cxxsuf(getsufp(t)) && cxxflag) ||
  761+                            (c=getsuf(t))=='c' || c=='S' || c=='i' ||
752762                             c=='s'|| Eflag || xcflag) {
 753763                                 clist[nc++] = t;
 754764                                 if (nc>=MAXFIL) {
     
 !
830840                 av[na++] = "-D__GNUC__=4";
 831841                 av[na++] = "-D__GNUC_MINOR__=3";
 832842                 av[na++] = "-D__GNUC_PATCHLEVEL__=1";
<>833 -                if (xgcc)
  843+                if (xgnu89)
834844                         av[na++] = "-D__GNUC_GNU_INLINE__=1";
 835845                 else
 836846                         av[na++] = "-D__GNUC_STDC_INLINE__=1";
     
 !
896906                 if (!nostdinc) {
 897907                         av[na++] = "-S", av[na++] = cat(sysroot, altincdir);
 898908                         av[na++] = "-S", av[na++] = cat(sysroot, incdir);
<> 909+                        if (cxxflag)
  910+                                av[na++] = "-S", av[na++] = pxxincdir;
899911                         av[na++] = "-S", av[na++] = pccincdir;
 900912                 }
 901913                 if (idirafter) {
     
 !
924936                  */
 925937         com:
 926938                 na = 0;
<>927 -                av[na++]= "ccom";
  939+                av[na++]= cxxflag ? "c++com" : "ccom";
928940                 if (Wallflag) {
 929941                         /* Set only the same flags as gcc */
 930942                         for (Wf = Wflags; Wf->name; Wf++) {
     
 !
971983                         av[na++] = "-xdeljumps";
 972984                         av[na++] = "-xinline";
 973985                 }
<>974 -                if (xgcc)
 975 -                        av[na++] = "-xgcc";
  986+                if (xgnu89)
  987+                        av[na++] = "-xgnu89";
  988+                if (xgnu99)
  989+                        av[na++] = "-xgnu99";
976990                 for (j = 0; j < xnum; j++)
 977991                         av[na++] = xlist[j];
 978992                 for (j = 0; j < nm; j++)
     
 !
13541368         return copy(base, 0);
 13551369 }
 13561370 
<> 1371+static char *cxxt[] = { "cc", "cp", "cxx", "cpp", "CPP", "c++", "C" };
13571372 int
<> 1373+cxxsuf(char *s)
  1374+{
  1375+        unsigned i;
  1376+        for (i = 0; i < sizeof(cxxt)/sizeof(cxxt[0]); i++)
  1377+                if (strcmp(s, cxxt[i]) == 0)
  1378+                        return 1;
  1379+        return 0;
  1380+}
  1381+
  1382+char *
  1383+getsufp(char *s)
  1384+{
  1385+        register char *p;
  1386+
  1387+        if ((p = strrchr(s, '.')) && p[1] != '\0')
  1388+                return &p[1];
  1389+        return "";
  1390+}
  1391+
  1392+int
<_13581393 getsuf(char *s)
 13591394 {
 13601395         register char *p;
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-18 13:31 +0100