* [LTP] Make global vars/funcs static, where possible #879 [not found] <CGME20211103090509eucms1p3879e480f890ad8e00a40febd3cf98279@eucms1p3> @ 2021-11-03 9:05 ` Krzysztof Dynowski 2021-11-03 9:19 ` Cyril Hrubis 0 siblings, 1 reply; 4+ messages in thread From: Krzysztof Dynowski @ 2021-11-03 9:05 UTC (permalink / raw) To: ltp@lists.linux.it [-- Attachment #1.1: Type: text/html, Size: 1544 bytes --] [-- Attachment #1.2: Type: image/gif, Size: 13168 bytes --] [-- Attachment #2: krzydyn:one-binary-build.patch --] [-- Type: application/octet-stream, Size: 11174 bytes --] From b0d53121a6cb36b7e4f1ed9418ef58763b5e7972 Mon Sep 17 00:00:00 2001 From: Krzysztof Dynowski <k.dynowski@samsung.com> Date: Wed, 3 Nov 2021 09:19:51 +0100 Subject: [PATCH] Make global variables static in misc/math/float Signed-off-by: Krzysztof Dynowski <k.dynowski@samsung.com> --- testcases/misc/math/abs/abs01.c | 10 ++--- testcases/misc/math/atof/atof01.c | 12 +++--- testcases/misc/math/float/main.c | 44 ++++++++++----------- testcases/misc/math/float/tfloat.h | 8 +--- testcases/misc/math/float/thread_code.c | 2 +- testcases/misc/math/fptests/fptest01.c | 30 +++++++------- testcases/misc/math/fptests/fptest02.c | 28 ++++++------- testcases/misc/math/nextafter/nextafter01.c | 16 ++++---- 8 files changed, 72 insertions(+), 78 deletions(-) diff --git a/testcases/misc/math/abs/abs01.c b/testcases/misc/math/abs/abs01.c index b05cf46ad..03704c05a 100644 --- a/testcases/misc/math/abs/abs01.c +++ b/testcases/misc/math/abs/abs01.c @@ -50,11 +50,11 @@ #define FAILED 0 #define PASSED 1 -char *TCID = "abs01"; -int local_flag = PASSED; -int block_number; -FILE *temp; -int TST_TOTAL = 1; +static const char *TCID = "abs01"; +static int local_flag = PASSED; +static int block_number; +static FILE *temp; +static int TST_TOTAL = 1; static void setup(void); static int blenter(void); diff --git a/testcases/misc/math/atof/atof01.c b/testcases/misc/math/atof/atof01.c index 98d085abb..67d904810 100644 --- a/testcases/misc/math/atof/atof01.c +++ b/testcases/misc/math/atof/atof01.c @@ -49,16 +49,16 @@ /***** *****/ #define ERR 0.0000001 -double pi; +static double pi; /*char progname[]= "atof1()"; */ /** LTP Port **/ -char *TCID = "atof01"; /* Test program identifier */ +static const char *TCID = "atof01"; /* Test program identifier */ -int local_flag = PASSED; -int block_number; -FILE *temp; -int TST_TOTAL = 1; +static int local_flag = PASSED; +static int block_number; +static FILE *temp; +static int TST_TOTAL = 1; static void setup(void); static void blenter(void); diff --git a/testcases/misc/math/float/main.c b/testcases/misc/math/float/main.c index 7285141a4..fecc154e5 100644 --- a/testcases/misc/math/float/main.c +++ b/testcases/misc/math/float/main.c @@ -29,13 +29,13 @@ #define SAFE_FREE(p) { if (p) { free(p); (p)=NULL; } } /* LTP status reporting */ -char *TCID; /* Test program identifier. */ -int TST_TOTAL = 1; /* Total number of test cases. */ +static char *TCID; /* Test program identifier. */ +static int TST_TOTAL = 1; /* Total number of test cases. */ /* To avoid extensive modifications to the code, use this bodge */ #define exit(x) myexit(x) -void myexit(int x) +static void myexit(int x) { if (x) tst_resm(TFAIL, "Test failed"); @@ -44,45 +44,45 @@ void myexit(int x) tst_exit(); } -TH_DATA *pcom; -TH_DATA **tabcom; -TH_DATA **tabcour; +static TH_DATA *pcom; +static TH_DATA **tabcom; +static TH_DATA **tabcour; #ifndef PATH_MAX #define PATH_MAX 1024 #endif -char datadir[PATH_MAX]; /* DATA directory */ +static char datadir[PATH_MAX]; /* DATA directory */ #ifndef PTHREAD_THREADS_MAX #define PTHREAD_THREADS_MAX 1024 #endif #define DEFAULT_NUM_THREADS 20 -int num_threads = DEFAULT_NUM_THREADS; -int num_loops = 500; +static int num_threads = DEFAULT_NUM_THREADS; +static int num_loops = 500; -int sig_cancel = 0; /* flag set by handle_signals to tell initial thread +static int sig_cancel = 0; /* flag set by handle_signals to tell initial thread to stop creating new threads (signal caught) */ -int indice = 0; /* # of threads created, to be canceled by handle_signals +static int indice = 0; /* # of threads created, to be canceled by handle_signals or waited for by initial thread */ -pthread_mutex_t sig_mutex; -pthread_t *threads; +static pthread_mutex_t sig_mutex; +static pthread_t *threads; -int debug = 0; -int true = 1; +static int debug = 0; +static int is_true = 1; static void *handle_signals(void *); static void sys_error(const char *, int); -const double EPS = 0.1e-300; +static const double EPS = 0.1e-300; -const int nb_func = NB_FUNC; +static const int nb_func = NB_FUNC; -int generate(char *datadir, char *bin_path) +static int generate(char *datadir, char *bin_path) { char *cmdline; - char *fmt = "cd %s; %s/%s %s"; + const char *fmt = "cd %s; %s/%s %s"; cmdline = malloc(2 * strlen(bin_path) + strlen(datadir) + strlen(GENERATOR) + strlen(fmt)); if (cmdline == NULL) @@ -229,7 +229,7 @@ int main(int argc, char *argv[]) indice = 0; for (i = 0; i < nb_func; i++) { - + tst_resm(TINFO, " > running test %d", i+1); for (th_num = 0; th_num < num_threads; th_num++) { /* allocate struct of commucation with the thread */ @@ -237,7 +237,7 @@ int main(int argc, char *argv[]) if (pcom == NULL) tst_brkm(TFAIL | TERRNO, cleanup, "calloc failed"); - *tabcour = (TH_DATA *) pcom; + *tabcour = pcom; tabcour++; /* * update structure of communication @@ -252,7 +252,7 @@ int main(int argc, char *argv[]) goto finished; } retval = pthread_create(&threads[indice], &newattr, - thread_code, (void *)pcom); + thread_code, pcom); if (retval != 0) sys_error("main : create FAILED", __LINE__); indice++; diff --git a/testcases/misc/math/float/tfloat.h b/testcases/misc/math/float/tfloat.h index 50cb73d10..438bbe728 100644 --- a/testcases/misc/math/float/tfloat.h +++ b/testcases/misc/math/float/tfloat.h @@ -53,11 +53,7 @@ #define FUNC_LDEXP 7 #define FUNC_GAM 8 -extern void * thread_code(void *); - -/* global variables, constants or initialized by main() */ -extern const double EPS; /* 0.1e-300 */ -extern int true, num_threads; +static void * thread_code(void *); /* * TH_DATA structures @@ -102,6 +98,4 @@ typedef struct { TH_FUNC th_func; } TH_DATA; -extern const TH_FUNC th_func[]; - #endif /* ifndef _TFLOAT_H */ diff --git a/testcases/misc/math/float/thread_code.c b/testcases/misc/math/float/thread_code.c index ca18cef1e..125a60c15 100644 --- a/testcases/misc/math/float/thread_code.c +++ b/testcases/misc/math/float/thread_code.c @@ -274,7 +274,7 @@ static void compute_ldexp(TH_DATA * th_data, double *din, double *dex, * pointer to a TH_DATA structure. * */ -void *thread_code(void *arg) +static void *thread_code(void *arg) { TH_DATA *th_data = (TH_DATA *) arg; size_t fsize, fsize2, fsize3; diff --git a/testcases/misc/math/fptests/fptest01.c b/testcases/misc/math/fptests/fptest01.c index 2072dced6..76d5b0121 100644 --- a/testcases/misc/math/fptests/fptest01.c +++ b/testcases/misc/math/fptests/fptest01.c @@ -61,8 +61,8 @@ /** LTP Port **/ #include "test.h" -char *TCID = "fptest01"; /* Test program identifier. */ -int TST_TOTAL = 1; /* Total number of test cases. */ +static const char *TCID = "fptest01"; /* Test program identifier. */ +static int TST_TOTAL = 1; /* Total number of test cases. */ /**************/ struct event { @@ -79,19 +79,19 @@ static int addevent(int, int, double); static void gaussinit(double, double); static double gauss(void); -struct event eventtab[EVENTMX]; -struct event rtrevent; -int waiting[EVENTMX]; /* array of waiting processors */ -int nwaiting; /* number of waiting processors */ -double global_time; /* global clock */ -double lsttime; /* time used for editing */ -double dtc, dts, alpha; /* timing parameters */ -int nproc; /* number of processors */ -int barcnt; /* number of processors ATBARRIER */ -int ncycle; /* number of cycles completed */ -int ncycmax; /* number of cycles to run */ -int critfree; /* TRUE if critical section not occupied */ -int gcount; /* # calls to gauss */ +static struct event eventtab[EVENTMX]; +static struct event rtrevent; +static int waiting[EVENTMX]; /* array of waiting processors */ +static int nwaiting; /* number of waiting processors */ +static double global_time; /* global clock */ +static double lsttime; /* time used for editing */ +static double dtc, dts, alpha; /* timing parameters */ +static int nproc; /* number of processors */ +static int barcnt; /* number of processors ATBARRIER */ +static int ncycle; /* number of cycles completed */ +static int ncycmax; /* number of cycles to run */ +static int critfree; /* TRUE if critical section not occupied */ +static int gcount; /* # calls to gauss */ static struct event *nextevent(void); diff --git a/testcases/misc/math/fptests/fptest02.c b/testcases/misc/math/fptests/fptest02.c index e6b49feb9..5bb849d65 100644 --- a/testcases/misc/math/fptests/fptest02.c +++ b/testcases/misc/math/fptests/fptest02.c @@ -61,8 +61,8 @@ /** LTP Port **/ #include "test.h" -char *TCID = "fptest02"; /* Test program identifier. */ -int TST_TOTAL = 1; /* Total number of test cases. */ +static const char *TCID = "fptest02"; /* Test program identifier. */ +static int TST_TOTAL = 1; /* Total number of test cases. */ /**************/ struct event { @@ -79,18 +79,18 @@ static int addevent(int, int, double); static void gaussinit(double, double, int); static double gauss(void); -struct event eventtab[EVENTMX]; -struct event rtrevent; -int waiting[EVENTMX]; /* array of waiting processors */ -int nwaiting; /* number of waiting processors */ -double sgtime; /* global clock */ -double lsttime; /* time used for editing */ -double dtc, dts, alpha; /* timing parameters */ -int nproc; /* number of processors */ -int barcnt; /* number of processors ATBARRIER */ -int ncycle; /* number of cycles completed */ -int ncycmax; /* number of cycles to run */ -int critfree; /* TRUE if critical section not occupied */ +static struct event eventtab[EVENTMX]; +static struct event rtrevent; +static int waiting[EVENTMX]; /* array of waiting processors */ +static int nwaiting; /* number of waiting processors */ +static double sgtime; /* global clock */ +static double lsttime; /* time used for editing */ +static double dtc, dts, alpha; /* timing parameters */ +static int nproc; /* number of processors */ +static int barcnt; /* number of processors ATBARRIER */ +static int ncycle; /* number of cycles completed */ +static int ncycmax; /* number of cycles to run */ +static int critfree; /* TRUE if critical section not occupied */ static struct event *nextevent(void ); diff --git a/testcases/misc/math/nextafter/nextafter01.c b/testcases/misc/math/nextafter/nextafter01.c index f4b212d4d..6faa4a7a5 100644 --- a/testcases/misc/math/nextafter/nextafter01.c +++ b/testcases/misc/math/nextafter/nextafter01.c @@ -43,16 +43,16 @@ #define FAILED 0 #define PASSED 1 -char *TCID = "nextafter01"; +static const char *TCID = "nextafter01"; -int local_flag = PASSED; -int block_number; -FILE *temp; -int TST_TOTAL = 1; +static int local_flag = PASSED; +static int block_number; +static FILE *temp; +static int TST_TOTAL = 1; -void setup(); -void blenter(); -void blexit(); +static void setup(); +static void blenter(); +static void blexit(); /*--------------------------------------------------------------*/ int main() -- 2.25.1 [-- Attachment #3: Type: text/plain, Size: 60 bytes --] -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] Make global vars/funcs static, where possible #879 2021-11-03 9:05 ` [LTP] Make global vars/funcs static, where possible #879 Krzysztof Dynowski @ 2021-11-03 9:19 ` Cyril Hrubis 0 siblings, 0 replies; 4+ messages in thread From: Cyril Hrubis @ 2021-11-03 9:19 UTC (permalink / raw) To: Krzysztof Dynowski; +Cc: ltp@lists.linux.it Hi! Can you please send patches inline so that we can reply and comment on them? See also: https://www.kernel.org/doc/html/v4.17/process/email-clients.html#email-clients -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CGME20211103090509eucms1p3879e480f890ad8e00a40febd3cf98279@eucms1p1>]
* [LTP] Make global vars/funcs static, where possible #879 [not found] <CGME20211103090509eucms1p3879e480f890ad8e00a40febd3cf98279@eucms1p1> @ 2021-11-03 11:34 ` Krzysztof Dynowski 2021-11-03 13:03 ` Cyril Hrubis 0 siblings, 1 reply; 4+ messages in thread From: Krzysztof Dynowski @ 2021-11-03 11:34 UTC (permalink / raw) To: ltp@lists.linux.it [-- Attachment #1.1: Type: text/html, Size: 24811 bytes --] [-- Attachment #1.2: Type: image/gif, Size: 13168 bytes --] [-- Attachment #2: Type: text/plain, Size: 60 bytes --] -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] Make global vars/funcs static, where possible #879 2021-11-03 11:34 ` Krzysztof Dynowski @ 2021-11-03 13:03 ` Cyril Hrubis 0 siblings, 0 replies; 4+ messages in thread From: Cyril Hrubis @ 2021-11-03 13:03 UTC (permalink / raw) To: Krzysztof Dynowski; +Cc: ltp@lists.linux.it Hi! First of all the mine type for the attachment is still wrong, it should be text/plain. > -char *TCID = "abs01"; > -int local_flag = PASSED; > -int block_number; > -FILE *temp; > -int TST_TOTAL = 1; > +static const char *TCID = "abs01"; Actually this is wrong, the test library makes use fo the TCID so it's not supposed to be static. > +static int local_flag = PASSED; > +static int block_number; > +static FILE *temp; > +static int TST_TOTAL = 1; Same for the TST_TOTAL. See lib/tst_res.c line 123. > static void setup(void); > static int blenter(void); > diff --git a/testcases/misc/math/atof/atof01.c > b/testcases/misc/math/atof/atof01.c > index 98d085abb..67d904810 100644 > --- a/testcases/misc/math/atof/atof01.c > +++ b/testcases/misc/math/atof/atof01.c > @@ -49,16 +49,16 @@ > /***** *****/ > #define ERR 0.0000001 > > -double pi; > +static double pi; > > /*char progname[]= "atof1()"; */ > /** LTP Port **/ > -char *TCID = "atof01"; /* Test program identifier */ > +static const char *TCID = "atof01"; /* Test program > identifier */ > > -int local_flag = PASSED; > -int block_number; > -FILE *temp; > -int TST_TOTAL = 1; > +static int local_flag = PASSED; > +static int block_number; > +static FILE *temp; > +static int TST_TOTAL = 1; > > static void setup(void); > static void blenter(void); > diff --git a/testcases/misc/math/float/main.c > b/testcases/misc/math/float/main.c > index 7285141a4..fecc154e5 100644 > --- a/testcases/misc/math/float/main.c > +++ b/testcases/misc/math/float/main.c > @@ -29,13 +29,13 @@ > > #define SAFE_FREE(p) { if (p) { free(p); (p)=NULL; } } > /* LTP status reporting */ > -char *TCID; /* Test program identifier. */ > -int TST_TOTAL = 1; /* Total number of test cases. */ > +static char *TCID; /* Test program identifier. > */ > +static int TST_TOTAL = 1; /* Total number of test cases. > */ > > /* To avoid extensive modifications to the code, use this bodge */ > #define exit(x) myexit(x) > > -void myexit(int x) > +static void myexit(int x) > { > if (x) > tst_resm(TFAIL, "Test failed"); > @@ -44,45 +44,45 @@ void myexit(int x) > tst_exit(); > } > > -TH_DATA *pcom; > -TH_DATA **tabcom; > -TH_DATA **tabcour; > +static TH_DATA *pcom; > +static TH_DATA **tabcom; > +static TH_DATA **tabcour; > #ifndef PATH_MAX > #define PATH_MAX 1024 > #endif > -char datadir[PATH_MAX]; /* DATA directory */ > +static char datadir[PATH_MAX]; /* DATA directory */ > > #ifndef PTHREAD_THREADS_MAX > #define PTHREAD_THREADS_MAX 1024 > #endif > #define DEFAULT_NUM_THREADS 20 > -int num_threads = DEFAULT_NUM_THREADS; > -int num_loops = 500; > +static int num_threads = DEFAULT_NUM_THREADS; > +static int num_loops = 500; > > -int sig_cancel = 0; /* flag set by handle_signals to tell > initial thread > +static int sig_cancel = 0; /* flag set by handle_signals > to tell initial thread > to stop creating new threads (signal > caught) */ > > -int indice = 0; /* # of threads created, to be > canceled by handle_signals > +static int indice = 0; /* # of threads created, to be > canceled by handle_signals > or waited for by initial thread */ > > -pthread_mutex_t sig_mutex; > -pthread_t *threads; > +static pthread_mutex_t sig_mutex; > +static pthread_t *threads; > > -int debug = 0; > -int true = 1; > +static int debug = 0; > +static int is_true = 1; > > static void *handle_signals(void *); > > static void sys_error(const char *, int); > > -const double EPS = 0.1e-300; > +static const double EPS = 0.1e-300; > > -const int nb_func = NB_FUNC; > +static const int nb_func = NB_FUNC; > > -int generate(char *datadir, char *bin_path) > +static int generate(char *datadir, char *bin_path) > { > char *cmdline; > - char *fmt = "cd %s; %s/%s %s"; > + const char *fmt = "cd %s; %s/%s %s"; > > cmdline = malloc(2 * strlen(bin_path) + strlen(datadir) + > strlen(GENERATOR) + strlen(fmt)); > if (cmdline == NULL) > @@ -229,7 +229,7 @@ int main(int argc, char *argv[]) > > indice = 0; > for (i = 0; i < nb_func; i++) { > - > + tst_resm(TINFO, " > running test %d", i+1); > for (th_num = 0; th_num < num_threads; th_num++) { > > /* allocate struct of commucation with the > thread */ > @@ -237,7 +237,7 @@ int main(int argc, char *argv[]) > if (pcom == NULL) > tst_brkm(TFAIL | TERRNO, cleanup, > "calloc failed"); > - *tabcour = (TH_DATA *) pcom; > + *tabcour = pcom; > tabcour++; > /* > * update structure of communication > @@ -252,7 +252,7 @@ int main(int argc, char *argv[]) > goto finished; > } > retval = pthread_create(&threads[indice], > &newattr, > - thread_code, (void > *)pcom); > + thread_code, pcom); > if (retval != 0) > sys_error("main : create FAILED", > __LINE__); > indice++; > diff --git a/testcases/misc/math/float/tfloat.h > b/testcases/misc/math/float/tfloat.h > index 50cb73d10..438bbe728 100644 > --- a/testcases/misc/math/float/tfloat.h > +++ b/testcases/misc/math/float/tfloat.h > @@ -53,11 +53,7 @@ > #define FUNC_LDEXP 7 > #define FUNC_GAM 8 > > -extern void * thread_code(void *); > - > -/* global variables, constants or initialized by main() */ > -extern const double EPS; /* 0.1e-300 */ > -extern int true, num_threads; And these three constansts seem to be shared between thread_code.c and main.c. I guess that proper fix would be to propagate them to the TH_DATA structure. > +static void * thread_code(void *); > > /* > * TH_DATA structures > @@ -102,6 +98,4 @@ typedef struct { > TH_FUNC th_func; > } TH_DATA; > > -extern const TH_FUNC th_func[]; This one as well, appears to be shared between different C source files. > #endif /* ifndef _TFLOAT_H */ > diff --git a/testcases/misc/math/float/thread_code.c > b/testcases/misc/math/float/thread_code.c > index ca18cef1e..125a60c15 100644 > --- a/testcases/misc/math/float/thread_code.c > +++ b/testcases/misc/math/float/thread_code.c > @@ -274,7 +274,7 @@ static void compute_ldexp(TH_DATA * th_data, double > *din, double *dex, > * pointer to a TH_DATA structure. > * > */ > -void *thread_code(void *arg) > +static void *thread_code(void *arg) > { > TH_DATA *th_data = (TH_DATA *) arg; > size_t fsize, fsize2, fsize3; > diff --git a/testcases/misc/math/fptests/fptest01.c > b/testcases/misc/math/fptests/fptest01.c > index 2072dced6..76d5b0121 100644 > --- a/testcases/misc/math/fptests/fptest01.c > +++ b/testcases/misc/math/fptests/fptest01.c > @@ -61,8 +61,8 @@ > /** LTP Port **/ > #include "test.h" > > -char *TCID = "fptest01"; /* Test program identifier. */ > -int TST_TOTAL = 1; /* Total number of test cases. */ > +static const char *TCID = "fptest01"; /* Test program identifier. > */ > +static int TST_TOTAL = 1; /* Total number of test cases. > */ > /**************/ > > struct event { > @@ -79,19 +79,19 @@ static int addevent(int, int, double); > static void gaussinit(double, double); > static double gauss(void); > > -struct event eventtab[EVENTMX]; > -struct event rtrevent; > -int waiting[EVENTMX]; /* array of waiting processors */ > -int nwaiting; /* number of waiting processors */ > -double global_time; /* global clock */ > -double lsttime; /* time used for editing */ > -double dtc, dts, alpha; /* timing parameters */ > -int nproc; /* number of processors */ > -int barcnt; /* number of processors ATBARRIER */ > -int ncycle; /* number of cycles completed */ > -int ncycmax; /* number of cycles to run */ > -int critfree; /* TRUE if critical section not > occupied */ > -int gcount; /* # calls to gauss */ > +static struct event eventtab[EVENTMX]; > +static struct event rtrevent; > +static int waiting[EVENTMX]; /* array of waiting processors > */ > +static int nwaiting; /* number of waiting processors > */ > +static double global_time; /* global clock */ > +static double lsttime; /* time used for editing */ > +static double dtc, dts, alpha; /* timing parameters */ > +static int nproc; /* number of processors */ > +static int barcnt; /* number of processors > ATBARRIER */ > +static int ncycle; /* number of cycles completed > */ > +static int ncycmax; /* number of cycles to run */ > +static int critfree; /* TRUE if critical section not > occupied */ > +static int gcount; /* # calls to gauss */ > > static struct event *nextevent(void); > > diff --git a/testcases/misc/math/fptests/fptest02.c > b/testcases/misc/math/fptests/fptest02.c > index e6b49feb9..5bb849d65 100644 > --- a/testcases/misc/math/fptests/fptest02.c > +++ b/testcases/misc/math/fptests/fptest02.c > @@ -61,8 +61,8 @@ > /** LTP Port **/ > #include "test.h" > > -char *TCID = "fptest02"; /* Test program identifier. */ > -int TST_TOTAL = 1; /* Total number of test cases. */ > +static const char *TCID = "fptest02"; /* Test program identifier. > */ > +static int TST_TOTAL = 1; /* Total number of test cases. > */ > /**************/ > > struct event { > @@ -79,18 +79,18 @@ static int addevent(int, int, double); > static void gaussinit(double, double, int); > static double gauss(void); > > -struct event eventtab[EVENTMX]; > -struct event rtrevent; > -int waiting[EVENTMX]; /* array of waiting processors */ > -int nwaiting; /* number of waiting processors */ > -double sgtime; /* global clock */ > -double lsttime; /* time used for editing */ > -double dtc, dts, alpha; /* timing parameters */ > -int nproc; /* number of processors */ > -int barcnt; /* number of processors ATBARRIER */ > -int ncycle; /* number of cycles completed */ > -int ncycmax; /* number of cycles to run */ > -int critfree; /* TRUE if critical section not > occupied */ > +static struct event eventtab[EVENTMX]; > +static struct event rtrevent; > +static int waiting[EVENTMX]; /* array of waiting processors > */ > +static int nwaiting; /* number of waiting processors > */ > +static double sgtime; /* global clock */ > +static double lsttime; /* time used for editing */ > +static double dtc, dts, alpha; /* timing parameters */ > +static int nproc; /* number of processors */ > +static int barcnt; /* number of processors > ATBARRIER */ > +static int ncycle; /* number of cycles completed > */ > +static int ncycmax; /* number of cycles to run */ > +static int critfree; /* TRUE if critical section not > occupied */ > > static struct event *nextevent(void ); > > diff --git a/testcases/misc/math/nextafter/nextafter01.c > b/testcases/misc/math/nextafter/nextafter01.c > index f4b212d4d..6faa4a7a5 100644 > --- a/testcases/misc/math/nextafter/nextafter01.c > +++ b/testcases/misc/math/nextafter/nextafter01.c > @@ -43,16 +43,16 @@ > #define FAILED 0 > #define PASSED 1 > > -char *TCID = "nextafter01"; > +static const char *TCID = "nextafter01"; > > -int local_flag = PASSED; > -int block_number; > -FILE *temp; > -int TST_TOTAL = 1; > +static int local_flag = PASSED; > +static int block_number; > +static FILE *temp; > +static int TST_TOTAL = 1; > > -void setup(); > -void blenter(); > -void blexit(); > +static void setup(); > +static void blenter(); > +static void blexit(); > > /*--------------------------------------------------------------*/ > int main() > -- > 2.25.1 -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-03 13:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20211103090509eucms1p3879e480f890ad8e00a40febd3cf98279@eucms1p3>
2021-11-03 9:05 ` [LTP] Make global vars/funcs static, where possible #879 Krzysztof Dynowski
2021-11-03 9:19 ` Cyril Hrubis
[not found] <CGME20211103090509eucms1p3879e480f890ad8e00a40febd3cf98279@eucms1p1>
2021-11-03 11:34 ` Krzysztof Dynowski
2021-11-03 13:03 ` Cyril Hrubis
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox