Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 113541 | Differences between
and this patch

Collapse All | Expand All

(-)gcc41/gcc/gcc.c (+72 lines)
Lines 334-339 static void display_help (void); Link Here
334
static void add_preprocessor_option (const char *, int);
334
static void add_preprocessor_option (const char *, int);
335
static void add_assembler_option (const char *, int);
335
static void add_assembler_option (const char *, int);
336
static void add_linker_option (const char *, int);
336
static void add_linker_option (const char *, int);
337
static void hijack_cflags (int *, const char ***);
337
static void process_command (int, const char **);
338
static void process_command (int, const char **);
338
static int execute (void);
339
static int execute (void);
339
static void alloc_args (void);
340
static void alloc_args (void);
Lines 3143-3148 add_linker_option (const char *option, i Link Here
3143
  linker_options [n_linker_options - 1] = save_string (option, len);
3144
  linker_options [n_linker_options - 1] = save_string (option, len);
3144
}
3145
}
3145
3146
3147
static const char **
3148
split_string (char *s, const char **vp, int *k, int sz)
3149
{
3150
  int j = 0;
3151
  while (s [j])
3152
    {
3153
      vp [*k] = &s [j];
3154
      while (s [j] && s [j] != ' ')
3155
	j ++;
3156
      if (s [j])
3157
	{
3158
	  s [j] = '\0';
3159
	  j ++;
3160
	  while (s [j] && s [j] == ' ')
3161
		j ++;
3162
	}
3163
      (*k) ++;
3164
      if ((*k) >= sz)
3165
	{
3166
	  sz += sz;
3167
	  vp = xrealloc (vp, sz * sizeof (char *));
3168
	}
3169
    }
3170
  vp [*k] = 0;
3171
  return vp;
3172
}
3173
3174
static void
3175
hijack_cflags (int *argcp, const char ***argvp)
3176
{
3177
  char *s, *t, **sp;
3178
  const char **vp;
3179
  int ssz, vsz, nsp, nvp, j, q, skip;
3180
3181
  s = getenv ("GCC_HIDDEN_CFLAGS");
3182
  t = getenv ("GCC_STRIP_CFLAGS");
3183
  if (s && s [0])
3184
    {
3185
      ssz = 4;
3186
      sp = xcalloc (ssz, sizeof (char *));
3187
      nsp = 0;
3188
      if (t && t [0])
3189
	sp = (char **) split_string (t, (const char **) sp, &nsp, ssz);
3190
      else
3191
	sp [0] = 0;
3192
      vsz = *argcp + 4;
3193
      vp = xcalloc (vsz, sizeof (char *));
3194
      nvp = q = 0;
3195
      skip = 0;
3196
      while (q < *argcp)
3197
	{
3198
	  for (j = 0; j < nsp; j ++)
3199
	    {
3200
	      if (!strcmp ((*argvp) [q], sp [j]))
3201
		skip = 1;
3202
	    }
3203
	  if (!skip)
3204
	    {
3205
	      vp [nvp] = (*argvp) [q];
3206
	      nvp ++;
3207
	    }
3208
	  skip = 0;
3209
	  q ++;
3210
	}
3211
      vp = split_string (s, vp, &nvp, vsz);
3212
      *argcp = nvp;
3213
      *argvp = vp;
3214
    }
3215
}
3216
3146
/* Create the vector `switches' and its contents.
3217
/* Create the vector `switches' and its contents.
3147
   Store its length in `n_switches'.  */
3218
   Store its length in `n_switches'.  */
3148
3219
Lines 6125-6130 main (int argc, const char **argv) Link Here
6125
     Make a table of specified input files (infiles, n_infiles).
6196
     Make a table of specified input files (infiles, n_infiles).
6126
     Decode switches that are handled locally.  */
6197
     Decode switches that are handled locally.  */
6127
6198
6199
  hijack_cflags (&argc, &argv);
6128
  process_command (argc, argv);
6200
  process_command (argc, argv);
6129
6201
6130
  /* Initialize the vector of specs to just the default.
6202
  /* Initialize the vector of specs to just the default.

Return to bug 113541