Skip to content

Commit

Permalink
remove overhead of unimplemented .SYMBOL feature
Browse files Browse the repository at this point in the history
Do_stat is very hot code (usually hitting the dir cache). This member
argument is from before git blame goes. The feature is unimplemented but
is legally parsable and then is a runtime error. In all the callers except
for Stat_target(),and then only in the A_SYMBOL branch, members is NULL.

Move the fatal error to A_SYMBOL branch and rid of passing NULL as an
argument in all other branches. For diagnostic reasons, DO_STAT macro
can't have its member arg removed.

Change Do_touch so it looks the same.
  • Loading branch information
bulk88 authored and mohawk2 committed Mar 9, 2015
1 parent 4558fae commit 5bfbca6
Show file tree
Hide file tree
Showing 44 changed files with 104 additions and 92 deletions.
4 changes: 2 additions & 2 deletions mac/arlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ char* lib;
warned = TRUE,
Warning("Can't extract library member timestamp;\n\
using library timestamp instead.");
return (Do_stat(lib, NULL, NULL, TRUE));
return (Do_stat(lib, NULL, TRUE));
}

PUBLIC int
Expand All @@ -51,6 +51,6 @@ char* lib;
warned = TRUE,
Warning("Can't update library member timestamp;\n\
touching library instead.");
return (Do_touch(lib, NULL, NULL));
return (Do_touch(lib, NULL));
}

4 changes: 2 additions & 2 deletions mac/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
10 changes: 6 additions & 4 deletions make.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ CELLPTR setdirroot;
* replaced. */
if( cp->ce_attr & A_LIBRARY )
if( tcp->ce_time <= cp->ce_time ) {
time_t mtime = Do_stat( name, tcp->ce_lib, NIL(char *), FALSE );
time_t mtime = Do_stat( name, tcp->ce_lib, FALSE );
if( mtime < tcp->ce_time ) tcp->ce_time = cp->ce_time+1L;
}

Expand Down Expand Up @@ -767,9 +767,11 @@ CELLPTR setdirroot;
printf("touch(%s(%s))", lib, name );
}

if( !Trace && !(cp->ce_attr & A_PHONY) )
if( Do_touch( name, lib,
(cp->ce_attr & A_SYMBOL) ? &name : NIL(char *) ) != 0 )
if( !Trace && !(cp->ce_attr & A_PHONY) )
/* .SYMBOL feature is not implement for touch */
if(cp->ce_attr & A_SYMBOL)
Fatal("Library symbol names not supported");
if( Do_touch( name, lib ) )
printf( " not touched - non-existant" );

if( (!(Glob_attr & A_SILENT) || !Trace) && !(cp->ce_attr & A_PHONY) )
Expand Down
4 changes: 2 additions & 2 deletions msdos/arlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ char* lib;
warned = TRUE,
Warning("Can't extract library member timestamp;\n\
using library timestamp instead.");
return (Do_stat(lib, NULL, NULL, TRUE));
return (Do_stat(lib, NULL, TRUE));
}

PUBLIC int
Expand All @@ -51,6 +51,6 @@ char* lib;
warned = TRUE,
Warning("Can't update library member timestamp;\n\
touching library instead.");
return (Do_touch(lib, NULL, NULL));
return (Do_touch(lib, NULL));
}

4 changes: 2 additions & 2 deletions msdos/borland/bcc30/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions msdos/borland/bcc40/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions msdos/borland/bcc45/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions msdos/borland/bcc50/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions msdos/borland/tcc20/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions msdos/microsft/msc51/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions msdos/microsft/msc60/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions msdos/zortech/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions os2/ibm/icc/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions os2/ibm/icc3/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions qssl/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
9 changes: 7 additions & 2 deletions stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ static int _check_dir_list ANSI((CELLPTR, CELLPTR, int, int));
time_t res;
DB_ENTER( "_do_stat" );

res = Do_stat(name, lib, sym, force);
if( member != NIL(char *) )
Fatal("Library symbol names not supported");

res = Do_stat(name, lib, force);

DB_PRINT( "stat", ("Statted [%s,%s,%d,%ld]", name, lib, sym, res) );

DB_RETURN( res );
}
#define DO_STAT(A,B,C,D) _do_stat(A,B,C,D)
#else
#define DO_STAT(A,B,C,D) Do_stat(A,B,C,D)
/* .SYMBOL isn't implemented, the NULL check constant folds away usually */
#define DO_STAT(A,B,C,D) (((C) != NIL(char *) && (Fatal("Library symbol names not supported"),1)), Do_stat(A,B,D))
#endif

static char *_first; /* If set this variable saves the first pathname that was
Expand Down
13 changes: 9 additions & 4 deletions sysintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,23 @@ DMPORTSTAT_T *buf;
);
}

/* member is part of the unimplemented .SYMBOL feature, see DO_STAT in stat.c */

PUBLIC time_t
Do_stat(name, lib, member, force)
Do_stat(name, lib, /*member,*/ force)
char *name;
char *lib;
char **member;
/*char **member;*/
int force;
{
char * basename;
DMPORTSTAT_T buf;
time_t seek_arch();

/*
if( member != NIL(char *) )
Fatal("Library symbol names not supported");
*/

basename = Basename(name);
if( lib != NIL(char) )
Expand All @@ -132,13 +135,15 @@ int force;
/* Touch existing file to force modify time to present.
*/
PUBLIC int
Do_touch(name, lib, member)
Do_touch(name, lib/*, member*/)
char *name;
char *lib;
char **member;
/* char **member; */
{
/*
if( member != NIL(char *) )
Fatal("Library symbol names not supported");
*/

if (lib != NIL(char))
return( touch_arch(Basename(name), lib) );
Expand Down
4 changes: 2 additions & 2 deletions tos/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/386ix/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/bsd43/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/bsd43/uw/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/bsd43/vf/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/bsdarm32/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/coherent/ver40/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/coherent/ver42/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/cygwin/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/linux/gnu/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/macosx/gnu/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/os2/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
4 changes: 2 additions & 2 deletions unix/solaris/gnu/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ char *Filedir ANSI((char *));
char *Build_path ANSI((char *, char *));
void Make_rules ANSI(());
void Create_macro_vars ANSI(());
time_t Do_stat ANSI((char *, char *, char **, int));
int Do_touch ANSI((char *, char *, char **));
time_t Do_stat ANSI((char *, char *, int));
int Do_touch ANSI((char *, char *));
void Void_lib_cache ANSI((char *, char *));
time_t Do_time ANSI(());
void Do_profile_output ANSI((char *, uint16, CELLPTR));
Expand Down
Loading

0 comments on commit 5bfbca6

Please sign in to comment.