5
5
6
6
Copyright (C) Andrew Tridgell 2002
7
7
Copyright (C) Martin Pool 2003
8
-
8
+
9
9
This program is free software; you can redistribute it and/or modify
10
10
it under the terms of the GNU General Public License as published by
11
11
the Free Software Foundation; either version 2 of the License, or
12
12
(at your option) any later version.
13
-
13
+
14
14
This program is distributed in the hope that it will be useful,
15
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
17
GNU General Public License for more details.
18
-
18
+
19
19
You should have received a copy of the GNU General Public License
20
20
along with this program; if not, write to the Free Software
21
21
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -130,8 +130,8 @@ static void failed(void)
130
130
}
131
131
132
132
133
- /* return a string to be used to distinguish temporary files
134
- this also tries to cope with NFS by adding the local hostname
133
+ /* return a string to be used to distinguish temporary files
134
+ this also tries to cope with NFS by adding the local hostname
135
135
*/
136
136
static const char * tmp_string (void )
137
137
{
@@ -175,7 +175,7 @@ static void to_cache(ARGS *args)
175
175
*
176
176
* unsetenv() is on BSD and Linux but not portable. */
177
177
putenv ("DEPENDENCIES_OUTPUT" );
178
-
178
+
179
179
if (getenv ("CCACHE_CPP2" )) {
180
180
args_add (args , input_file );
181
181
} else {
@@ -225,7 +225,7 @@ static void to_cache(ARGS *args)
225
225
exit (status );
226
226
}
227
227
}
228
-
228
+
229
229
unlink (tmp_stderr );
230
230
unlink (tmp_hashname );
231
231
failed ();
@@ -275,7 +275,7 @@ static void find_hash(ARGS *args)
275
275
int nlevels = 2 ;
276
276
char * input_base ;
277
277
char * tmp ;
278
-
278
+
279
279
if ((s = getenv ("CCACHE_NLEVELS" ))) {
280
280
nlevels = atoi (s );
281
281
if (nlevels < 1 ) nlevels = 1 ;
@@ -361,7 +361,7 @@ static void find_hash(ARGS *args)
361
361
}
362
362
}
363
363
364
- /* ~/hello.c -> tmp.hello.123.i
364
+ /* ~/hello.c -> tmp.hello.123.i
365
365
limit the basename to 10
366
366
characters in order to cope with filesystem with small
367
367
maximum filename length limits */
@@ -376,7 +376,7 @@ static void find_hash(ARGS *args)
376
376
377
377
/* now the run */
378
378
x_asprintf (& path_stdout , "%s/%s.tmp.%s.%s" , temp_dir ,
379
- input_base , tmp_string (),
379
+ input_base , tmp_string (),
380
380
i_extension );
381
381
x_asprintf (& path_stderr , "%s/tmp.cpp_stderr.%s" , temp_dir , tmp_string ());
382
382
@@ -412,7 +412,7 @@ static void find_hash(ARGS *args)
412
412
/* if the compilation is with -g then we have to include the whole of the
413
413
preprocessor output, which means we are sensitive to line number
414
414
information. Otherwise we can discard line number info, which makes
415
- us less sensitive to reformatting changes
415
+ us less sensitive to reformatting changes
416
416
417
417
Note! I have now disabled the unification code by default
418
418
as it gives the wrong line numbers for warnings. Pity.
@@ -434,7 +434,7 @@ static void find_hash(ARGS *args)
434
434
data and output it just before the main stderr from the compiler
435
435
pass */
436
436
cpp_stderr = path_stderr ;
437
- } else {
437
+ } else {
438
438
unlink (path_stderr );
439
439
free (path_stderr );
440
440
}
@@ -464,7 +464,7 @@ static void find_hash(ARGS *args)
464
464
}
465
465
466
466
467
- /*
467
+ /*
468
468
try to return the compile result from cache. If we can return from
469
469
cache then this function exits with the correct status code,
470
470
otherwise it returns */
@@ -541,7 +541,7 @@ static void from_cache(int first)
541
541
if (ret == -1 ) {
542
542
ret = copy_file (hashname , output_file );
543
543
if (ret == -1 ) {
544
- cc_log ("failed to copy %s -> %s (%s)\n" ,
544
+ cc_log ("failed to copy %s -> %s (%s)\n" ,
545
545
hashname , output_file , strerror (errno ));
546
546
stats_update (STATS_ERROR );
547
547
failed ();
@@ -580,7 +580,7 @@ static void from_cache(int first)
580
580
exit (0 );
581
581
}
582
582
583
- /* find the real compiler. We just search the PATH to find a executable of the
583
+ /* find the real compiler. We just search the PATH to find a executable of the
584
584
same name that isn't a link to ourselves */
585
585
static void find_compiler (int argc , char * * argv )
586
586
{
@@ -646,8 +646,8 @@ static const char *check_extension(const char *fname, int *direct_i)
646
646
}
647
647
648
648
649
- /*
650
- process the compiler options to form the correct set of options
649
+ /*
650
+ process the compiler options to form the correct set of options
651
651
for obtaining the preprocessor output
652
652
*/
653
653
static void process_args (int argc , char * * argv )
@@ -701,7 +701,7 @@ static void process_args(int argc, char **argv)
701
701
found_S_opt = 1 ;
702
702
continue ;
703
703
}
704
-
704
+
705
705
/* we need to work out where the output was meant to go */
706
706
if (strcmp (argv [i ], "-o" ) == 0 ) {
707
707
if (i == argc - 1 ) {
@@ -713,15 +713,15 @@ static void process_args(int argc, char **argv)
713
713
i ++ ;
714
714
continue ;
715
715
}
716
-
716
+
717
717
/* alternate form of -o, with no space */
718
718
if (strncmp (argv [i ], "-o" , 2 ) == 0 ) {
719
719
output_file = & argv [i ][2 ];
720
720
continue ;
721
721
}
722
722
723
723
/* debugging is handled specially, so that we know if we
724
- can strip line number info
724
+ can strip line number info
725
725
*/
726
726
if (strncmp (argv [i ], "-g" , 2 ) == 0 ) {
727
727
args_add (stripped_args , argv [i ]);
@@ -757,21 +757,21 @@ static void process_args(int argc, char **argv)
757
757
{
758
758
const char * opts [] = {"-I" , "-include" , "-imacros" , "-iprefix" ,
759
759
"-iwithprefix" , "-iwithprefixbefore" ,
760
- "-L" , "-D" , "-U" , "-x" , "-MF" ,
760
+ "-L" , "-D" , "-U" , "-x" , "-MF" ,
761
761
"-MT" , "-MQ" , "-isystem" , "-aux-info" ,
762
762
"--param" , "-A" , "-Xlinker" , "-u" ,
763
- "-idirafter" ,
763
+ "-idirafter" ,
764
764
NULL };
765
765
int j ;
766
766
for (j = 0 ;opts [j ];j ++ ) {
767
767
if (strcmp (argv [i ], opts [j ]) == 0 ) {
768
768
if (i == argc - 1 ) {
769
- cc_log ("missing argument to %s\n" ,
769
+ cc_log ("missing argument to %s\n" ,
770
770
argv [i ]);
771
771
stats_update (STATS_ARGS );
772
772
failed ();
773
773
}
774
-
774
+
775
775
args_add (stripped_args , argv [i ]);
776
776
args_add (stripped_args , argv [i + 1 ]);
777
777
i ++ ;
@@ -792,7 +792,7 @@ static void process_args(int argc, char **argv)
792
792
cope better with unusual compiler options */
793
793
if (stat (argv [i ], & st ) != 0 || !S_ISREG (st .st_mode )) {
794
794
args_add (stripped_args , argv [i ]);
795
- continue ;
795
+ continue ;
796
796
}
797
797
798
798
if (input_file ) {
@@ -882,7 +882,7 @@ static void process_args(int argc, char **argv)
882
882
}
883
883
else {
884
884
int len = p - default_depfile_name ;
885
-
885
+
886
886
p = x_malloc (len + 3 );
887
887
strncpy (default_depfile_name , p , len - 1 );
888
888
free (default_depfile_name );
@@ -922,7 +922,7 @@ static void ccache(int argc, char *argv[])
922
922
cc_log ("ccache is disabled\n" );
923
923
failed ();
924
924
}
925
-
925
+
926
926
/* we might be disabled */
927
927
if (getenv ("CCACHE_DISABLE" )) {
928
928
cc_log ("ccache is disabled\n" );
@@ -946,7 +946,7 @@ static void ccache(int argc, char *argv[])
946
946
cc_log ("read-only set - doing real compile\n" );
947
947
failed ();
948
948
}
949
-
949
+
950
950
prefix = getenv ("CCACHE_PREFIX" );
951
951
if (prefix ) {
952
952
char * p = find_executable (prefix , MYNAME );
@@ -974,7 +974,7 @@ static void usage(void)
974
974
{
975
975
printf ("ccache, a compiler cache. Version %s\n" , CCACHE_VERSION );
976
976
printf ("Copyright Andrew Tridgell, 2002\n\n" );
977
-
977
+
978
978
printf ("Usage:\n" );
979
979
printf ("\tccache [options]\n" );
980
980
printf ("\tccache compiler [compile options]\n" );
@@ -1028,7 +1028,7 @@ static int ccache_main(int argc, char *argv[])
1028
1028
case 'h' :
1029
1029
usage ();
1030
1030
exit (0 );
1031
-
1031
+
1032
1032
case 's' :
1033
1033
check_cache_dir ();
1034
1034
stats_summary ();
@@ -1090,7 +1090,7 @@ static void setup_uncached_err(void)
1090
1090
{
1091
1091
char * buf ;
1092
1092
int uncached_fd ;
1093
-
1093
+
1094
1094
uncached_fd = dup (2 );
1095
1095
if (uncached_fd == -1 ) {
1096
1096
cc_log ("dup(2) failed\n" );
@@ -1127,7 +1127,7 @@ int main(int argc, char *argv[])
1127
1127
cache_logfile = getenv ("CCACHE_LOGFILE" );
1128
1128
1129
1129
setup_uncached_err ();
1130
-
1130
+
1131
1131
1132
1132
/* the user might have set CCACHE_UMASK */
1133
1133
p = getenv ("CCACHE_UMASK" );
@@ -1157,7 +1157,7 @@ int main(int argc, char *argv[])
1157
1157
1158
1158
/* make sure the cache dir exists */
1159
1159
if (cache_dir && (create_dir (cache_dir ) != 0 )) {
1160
- fprintf (stderr ,"ccache: failed to create %s (%s)\n" ,
1160
+ fprintf (stderr ,"ccache: failed to create %s (%s)\n" ,
1161
1161
cache_dir , strerror (errno ));
1162
1162
exit (1 );
1163
1163
}
0 commit comments