Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.222
 
1.223
 
MAIN:ragge:20120803082710
 
cc.c
_>159159 #define MAXFIL 10000
 160160 #define MAXLIB 10000
 161161 #define MAXAV  10000
<>162 -#define MAXOPT 200
163162 char    *tmp3;
 164163 char    *tmp4;
 165164 char    *outfile, *ermfile;
     
 !
184183 void *ccmalloc(int size);
 185184 void aerror(char *);
 186185 void oerror(char *);
<> 186+void owarning(char *);
187187 char *argnxt(char *, char *);
 188188 char *nxtopt(char *o);
 189189 void setup_cpp_flags(void);
     
 !
202202 char    *mlist[100];
 203203 char    *flist[100];
 204204 char    *wlist[100];
<>205 -char    *idirafter;
206205 int     nm;
 207206 int     nf;
 208207 int     nw;
     
 !
221220 int     kflag;  /* generate PIC/pic code */
 222221 #define F_PIC   1
 223222 #define F_pic   2
<>224 -int     Mflag, MPflag, nMfiles/* dependencies only */
 225 -char    *Mfiles[10];
  223+int     Mflag, needM;   /* dependencies only */
226224 int     pgflag;
 227225 int     exfail;
 228226 int     Xflag;
     
 !
284282 #ifndef STARTLABEL
 285283 #define STARTLABEL "__start"
 286284 #endif
<>287 -char *incdir = STDINC;
 288 -char *altincdir = INCLUDEDIR "pcc/";
 289 -char *libdir = LIBDIR;
 290 -#ifdef PCCINCDIR
 291 -char *pccincdir = PCCINCDIR;
 292 -char *pxxincdir = PCCINCDIR "/c++";
 293 -#endif
294285 #ifdef PCCLIBDIR
 295286 char *pcclibdir = PCCLIBDIR;
 296287 #endif
     
 !
377368 #endif
 378369 
 379370 struct strlist preprocessor_flags;
<> 371+struct strlist depflags;
380372 struct strlist incdirs;
 381373 struct strlist user_sysincdirs;
 382374 struct strlist includes;
 383375 struct strlist sysincdirs;
<> 376+struct strlist dirafterdirs;
384377 struct strlist crtdirs;
 385378 struct strlist libdirs;
 386379 struct strlist progdirs;
     
 !
405398         strlist_init(&user_sysincdirs);
 406399         strlist_init(&includes);
 407400         strlist_init(&sysincdirs);
<> 401+        strlist_init(&dirafterdirs);
  402+        strlist_init(&depflags);
408403 
 409404         if ((t = strrchr(argv[0], '/')))
 410405                 t = copy(t+1, 0);
     
 !
605600                         } else if (match(argp, "-isysroot")) {
 606601                                 isysroot = nxtopt(0);
 607602                         } else if (strcmp(argp, "-idirafter") == 0) {
<>608 -                                idirafter = nxtopt(0);
  603+                                strlist_append(&dirafterdirs, nxtopt(0));
609604 #ifdef os_darwin
 610605                         } else if (strcmp(argp, "-install_name") == 0) {
 611606                                 llist[nl++] = argp;
     
 !
736731 #endif
 737732                                 cflag++;
 738733                         break;
<>739 -#if 0
 740 -                case '2':
 741 -                        if(argp[2] == '\0')
 742 -                                pref = "/lib/crt2.o";
 743 -                        else {
 744 -                                pref = "/lib/crt20.o";
 745 -                        }
 746 -                        break;
 747 -#endif
  734+
748735                 case 'M':
 749736                         switch (argp[2]) {
<>750 -                        case '\0': Mflag++; break;
 751 -                        case 'P': MPflag++; break;
 752 -                        case 'F': outfile = nxtopt(0); break;
  737+                        case '\0':
  738+                                Mflag++;
  739+                                strlist_append(&depflags, argp);
  740+                                break;
  741+                        case 'P':
  742+                                needM = 1;
  743+                                strlist_append(&depflags, "-xMP");
  744+                                break;
  745+                        case 'F':
  746+                                needM = 1;
  747+                                outfile = nxtopt("-MF");
  748+                                break;
753749                         case 'T':
 754750                         case 'Q':
<>755 -                                j = strlen(u = nxtopt(0));
 756 -                                t = copy("-xM.,", j);
  751+                                needM = 1;
  752+                                j = strlen(u = nxtopt("-MT"));
  753+                                t = copy("-xMT,", j);
757754                                 strlcat(t, u, j+6);
 758755                                 t[3] = argp[2];
<>759 -                                Mfiles[nMfiles++] = t;
  756+                                strlist_append(&depflags, t);
760757                                 break;
 761758                         default:
 762759                                 oerror(argp);
     
 !
829826                 }
 830827         }
 831828 
<>832 -        setup_cpp_flags();
 833 -
 834 -        if (isysroot == NULL)
 835 -                isysroot = sysroot;
 836 -        expand_sysroot();
 837 -
838829         /* Sanity checking */
 839830         if (cppflag) {
 840831                 if (nc == 0)
     
 !
850841                 errorx(8, "-o given with -c || -E || -S and more than one file");
 851842         if (outfile && clist[0] && strcmp(outfile, clist[0]) == 0)
 852843                 errorx(8, "output file will be clobbered");
<> 844+
  845+        if (needM && !Mflag)
  846+                errorx(8, "to make dependencies needs -M");
  847+
  848+
853849         if (nc==0)
 854850                 goto nocom;
 855851         if (pflag==0) {
     
 !
862858         if (signal(SIGTERM, SIG_IGN) != SIG_IGN)        /* terminate */
 863859                 signal(SIGTERM, idexit);
 864860 
<> 861+        setup_cpp_flags();
  862+
  863+        if (isysroot == NULL)
  864+                isysroot = sysroot;
  865+        expand_sysroot();
  866+
865867         for (i=0; i<nc; i++) {
 866868                 /*
 867869                  * C preprocessor
     
 !
889891                 na = 0;
 890892                 av[na++] = "cpp";
 891893 
<>892 -                if (Mflag)
 893 -                        av[na++] = "-M";
 894 -                if (MPflag)
 895 -                        av[na++] = "-xMP";
 896 -                for (j = 0; j < nMfiles; j++)
 897 -                        av[na++] = Mfiles[j];
  894+                STRLIST_FOREACH(s, &depflags) {
  895+                        av[na++] = s->value;
  896+                }
898897                 STRLIST_FOREACH(s, &preprocessor_flags) {
 899898                         av[na++] = s->value;
 900899                 }
     
 !
910909                         av[na++] = "-S";
 911910                         av[na++] = s->value;
 912911                 }
<>913 -
914912                 if (!nostdinc) {
 915913                         STRLIST_FOREACH(s, &sysincdirs) {
 916914                                 av[na++] = "-S";
 917915                                 av[na++] = s->value;
 918916                         }
 919917                 }
<>920 -
 921 -                if (idirafter) {
 922 -                        av[na++] = "-I";
 923 -                        av[na++] = idirafter;
  918+                STRLIST_FOREACH(s, &dirafterdirs) {
  919+                        av[na++] = "-S";
  920+                        av[na++] = s->value;
924921                 }
<> 922+
925923                 av[na++] = clist[i];
 926924                 if (!Eflag && !Mflag)
 927925                         av[na++] = tmp4;
     
 !
12731271         strlist_free(&user_sysincdirs);
 12741272         strlist_free(&includes);
 12751273         strlist_free(&sysincdirs);
<> 1274+        strlist_free(&dirafterdirs);
  1275+        strlist_free(&depflags);
12761276 #endif
 12771277         dexit(eflag);
 12781278         return 0;
     
 !
16131613 {
 16141614         struct string *s;
 16151615         struct strlist *lists[] = { &crtdirs, &sysincdirs, &incdirs,
<>1616 -            &user_sysincdirs, &libdirs, &progdirs, NULL };
  1616+            &user_sysincdirs, &libdirs, &progdirs, &dirafterdirs, NULL };
16171617         const char *sysroots[] = { sysroot, isysroot, isysroot, isysroot,
<>1618 -            sysroot, sysroot, NULL };
  1618+            sysroot, sysroot, isysroot, NULL };
16191619         size_t i, sysroot_len, value_len;
 16201620         char *path;
 16211621 
     
 !
16401640 
 16411641 
 16421642 void
<> 1643+owarning(char *s)
  1644+{
  1645+        fprintf(stderr, "warning: unknown option '%s'\n", s);
  1646+}
  1647+
  1648+void
<_16431649 oerror(char *s)
 16441650 {
 16451651         fprintf(stderr, "error: unknown option '%s'\n", s);
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-07-10 04:49 +0200