<HTML><HEAD>
<META content=IE=5 http-equiv=X-UA-Compatible>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<STYLE id=mysingle_style type=text/css>.search-word {
        BACKGROUND-COLOR: #ffee94
}
P {
        FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; FONT-FAMILY: Arial, arial; MARGIN-TOP: 5px
}
TD {
        FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; FONT-FAMILY: Arial, arial; MARGIN-TOP: 5px
}
LI {
        FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; FONT-FAMILY: Arial, arial; MARGIN-TOP: 5px
}
BODY {
        FONT-SIZE: 10pt; FONT-FAMILY: Arial, arial
}
</STYLE>

<STYLE id=knox_style type=text/css>P {
        FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; FONT-FAMILY: Arial, arial; MARGIN-TOP: 5px
}
</STYLE>

<META name=GENERATOR content=ActiveSquare>
<STYLE id=knox_style type=text/css>P {
        FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; FONT-FAMILY: Arial, arial; MARGIN-TOP: 5px
}
</STYLE>
</HEAD>
<BODY style="OVERFLOW: auto">
<P>From b0d53121a6cb36b7e4f1ed9418ef58763b5e7972 Mon Sep 17 00:00:00 2001<BR>From: Krzysztof Dynowski <<A href="mailto:k.dynowski@samsung.com">k.dynowski@samsung.com</A>><BR>Date: Wed, 3 Nov 2021 09:19:51 +0100<BR>Subject: [PATCH] Make global variables static in misc/math/float</P>
<P>Signed-off-by:  Krzysztof Dynowski <<A href="mailto:k.dynowski@samsung.com">k.dynowski@samsung.com</A>><BR>---<BR> testcases/misc/math/abs/abs01.c             | 10 ++---<BR> testcases/misc/math/atof/atof01.c           | 12 +++---<BR> testcases/misc/math/float/main.c            | 44 ++++++++++-----------<BR> testcases/misc/math/float/tfloat.h          |  8 +---<BR> testcases/misc/math/float/thread_code.c     |  2 +-<BR> testcases/misc/math/fptests/fptest01.c      | 30 +++++++-------<BR> testcases/misc/math/fptests/fptest02.c      | 28 ++++++-------<BR> testcases/misc/math/nextafter/nextafter01.c | 16 ++++----<BR> 8 files changed, 72 insertions(+), 78 deletions(-)</P>
<P>diff --git a/testcases/misc/math/abs/abs01.c b/testcases/misc/math/abs/abs01.c<BR>index b05cf46ad..03704c05a 100644<BR>--- a/testcases/misc/math/abs/abs01.c<BR>+++ b/testcases/misc/math/abs/abs01.c<BR>@@ -50,11 +50,11 @@<BR> #define FAILED 0<BR> #define PASSED 1</P>
<P>-char *TCID = "abs01";<BR>-int local_flag = PASSED;<BR>-int block_number;<BR>-FILE *temp;<BR>-int TST_TOTAL = 1;<BR>+static const char *TCID = "abs01";<BR>+static int local_flag = PASSED;<BR>+static int block_number;<BR>+static FILE *temp;<BR>+static int TST_TOTAL = 1;</P>
<P> static void setup(void);<BR> static int blenter(void);<BR>diff --git a/testcases/misc/math/atof/atof01.c b/testcases/misc/math/atof/atof01.c<BR>index 98d085abb..67d904810 100644<BR>--- a/testcases/misc/math/atof/atof01.c<BR>+++ b/testcases/misc/math/atof/atof01.c<BR>@@ -49,16 +49,16 @@<BR> /*****         *****/<BR> #define ERR            0.0000001</P>
<P>-double pi;<BR>+static double pi;</P>
<P> /*char progname[]= "atof1()"; */<BR> /**    LTP Port        **/<BR>-char *TCID = "atof01";         /* Test program identifier */<BR>+static const char *TCID = "atof01";            /* Test program identifier */</P>
<P>-int local_flag = PASSED;<BR>-int block_number;<BR>-FILE *temp;<BR>-int TST_TOTAL = 1;<BR>+static int local_flag = PASSED;<BR>+static int block_number;<BR>+static FILE *temp;<BR>+static int TST_TOTAL = 1;</P>
<P> static void setup(void);<BR> static void blenter(void);<BR>diff --git a/testcases/misc/math/float/main.c b/testcases/misc/math/float/main.c<BR>index 7285141a4..fecc154e5 100644<BR>--- a/testcases/misc/math/float/main.c<BR>+++ b/testcases/misc/math/float/main.c<BR>@@ -29,13 +29,13 @@</P>
<P> #define SAFE_FREE(p) { if (p) { free(p); (p)=NULL; } }<BR> /* LTP status reporting */<BR>-char *TCID;                    /* Test program identifier.    */<BR>-int TST_TOTAL = 1;             /* Total number of test cases. */<BR>+static char *TCID;                     /* Test program identifier.    */<BR>+static int TST_TOTAL = 1;              /* Total number of test cases. */</P>
<P> /* To avoid extensive modifications to the code, use this bodge */<BR> #define exit(x) myexit(x)</P>
<P>-void myexit(int x)<BR>+static void myexit(int x)<BR> {<BR>        if (x)<BR>                tst_resm(TFAIL, "Test failed");<BR>@@ -44,45 +44,45 @@ void myexit(int x)<BR>        tst_exit();<BR> }</P>
<P>-TH_DATA *pcom;<BR>-TH_DATA **tabcom;<BR>-TH_DATA **tabcour;<BR>+static TH_DATA *pcom;<BR>+static TH_DATA **tabcom;<BR>+static TH_DATA **tabcour;<BR> #ifndef        PATH_MAX<BR> #define PATH_MAX               1024<BR> #endif<BR>-char datadir[PATH_MAX];                /* DATA directory */<BR>+static char datadir[PATH_MAX];         /* DATA directory */</P>
<P> #ifndef PTHREAD_THREADS_MAX<BR> #define PTHREAD_THREADS_MAX    1024<BR> #endif<BR> #define DEFAULT_NUM_THREADS    20<BR>-int num_threads = DEFAULT_NUM_THREADS;<BR>-int num_loops = 500;<BR>+static int num_threads = DEFAULT_NUM_THREADS;<BR>+static int num_loops = 500;</P>
<P>-int sig_cancel = 0;            /* flag set by handle_signals to tell initial thread<BR>+static int sig_cancel = 0;             /* flag set by handle_signals to tell initial thread<BR>                                   to stop creating new threads (signal caught) */</P>
<P>-int indice = 0;                        /* # of threads created, to be canceled by handle_signals<BR>+static int indice = 0;                 /* # of threads created, to be canceled by handle_signals<BR>                                   or waited for by initial thread */</P>
<P>-pthread_mutex_t sig_mutex;<BR>-pthread_t *threads;<BR>+static pthread_mutex_t sig_mutex;<BR>+static pthread_t *threads;</P>
<P>-int debug = 0;<BR>-int true = 1;<BR>+static int debug = 0;<BR>+static int is_true = 1;</P>
<P> static void *handle_signals(void *);</P>
<P> static void sys_error(const char *, int);</P>
<P>-const double EPS = 0.1e-300;<BR>+static const double EPS = 0.1e-300;</P>
<P>-const int nb_func = NB_FUNC;<BR>+static const int nb_func = NB_FUNC;</P>
<P>-int generate(char *datadir, char *bin_path)<BR>+static int generate(char *datadir, char *bin_path)<BR> {<BR>        char *cmdline;<BR>-       char *fmt = "cd %s; %s/%s %s";<BR>+       const char *fmt = "cd %s; %s/%s %s";</P>
<P>        cmdline = malloc(2 * strlen(bin_path) + strlen(datadir) + strlen(GENERATOR) + strlen(fmt));<BR>        if (cmdline == NULL)<BR>@@ -229,7 +229,7 @@ int main(int argc, char *argv[])</P>
<P>        indice = 0;<BR>        for (i = 0; i < nb_func; i++) {<BR>-<BR>+               tst_resm(TINFO, "  > running test %d", i+1);<BR>                for (th_num = 0; th_num < num_threads; th_num++) {</P>
<P>                        /* allocate struct of commucation  with the thread */<BR>@@ -237,7 +237,7 @@ int main(int argc, char *argv[])<BR>                        if (pcom == NULL)<BR>                                tst_brkm(TFAIL | TERRNO, cleanup,<BR>                                         "calloc failed");<BR>-                       *tabcour = (TH_DATA *) pcom;<BR>+                       *tabcour = pcom;<BR>                        tabcour++;<BR>                        /*<BR>                         * update structure of communication<BR>@@ -252,7 +252,7 @@ int main(int argc, char *argv[])<BR>                                goto finished;<BR>                        }<BR>                        retval = pthread_create(&threads[indice], &newattr,<BR>-                                               thread_code, (void *)pcom);<BR>+                                               thread_code, pcom);<BR>                        if (retval != 0)<BR>                                sys_error("main : create FAILED", __LINE__);<BR>                        indice++;<BR>diff --git a/testcases/misc/math/float/tfloat.h b/testcases/misc/math/float/tfloat.h<BR>index 50cb73d10..438bbe728 100644<BR>--- a/testcases/misc/math/float/tfloat.h<BR>+++ b/testcases/misc/math/float/tfloat.h<BR>@@ -53,11 +53,7 @@<BR> #define FUNC_LDEXP             7<BR> #define FUNC_GAM               8</P>
<P>-extern void * thread_code(void *);<BR>-<BR>-/* global variables, constants or initialized by main() */<BR>-extern const double EPS; /* 0.1e-300 */<BR>-extern int true, num_threads;<BR>+static void * thread_code(void *);</P>
<P> /*<BR>  * TH_DATA structures<BR>@@ -102,6 +98,4 @@ typedef struct {<BR>        TH_FUNC th_func;<BR> } TH_DATA;</P>
<P>-extern const TH_FUNC th_func[];<BR>-<BR> #endif /* ifndef _TFLOAT_H */<BR>diff --git a/testcases/misc/math/float/thread_code.c b/testcases/misc/math/float/thread_code.c<BR>index ca18cef1e..125a60c15 100644<BR>--- a/testcases/misc/math/float/thread_code.c<BR>+++ b/testcases/misc/math/float/thread_code.c<BR>@@ -274,7 +274,7 @@ static void compute_ldexp(TH_DATA * th_data, double *din, double *dex,<BR>  *     pointer to a TH_DATA structure.<BR>  *<BR>  */<BR>-void *thread_code(void *arg)<BR>+static void *thread_code(void *arg)<BR> {<BR>        TH_DATA *th_data = (TH_DATA *) arg;<BR>        size_t fsize, fsize2, fsize3;<BR>diff --git a/testcases/misc/math/fptests/fptest01.c b/testcases/misc/math/fptests/fptest01.c<BR>index 2072dced6..76d5b0121 100644<BR>--- a/testcases/misc/math/fptests/fptest01.c<BR>+++ b/testcases/misc/math/fptests/fptest01.c<BR>@@ -61,8 +61,8 @@<BR> /** LTP Port **/<BR> #include "test.h"</P>
<P>-char *TCID = "fptest01";       /* Test program identifier.    */<BR>-int TST_TOTAL = 1;             /* Total number of test cases. */<BR>+static const char *TCID = "fptest01";  /* Test program identifier.    */<BR>+static int TST_TOTAL = 1;              /* Total number of test cases. */<BR> /**************/</P>
<P> struct event {<BR>@@ -79,19 +79,19 @@ static int addevent(int, int, double);<BR> static void gaussinit(double, double);<BR> static double gauss(void);</P>
<P>-struct event eventtab[EVENTMX];<BR>-struct event rtrevent;<BR>-int waiting[EVENTMX];          /* array of waiting processors */<BR>-int nwaiting;                  /* number of waiting processors */<BR>-double global_time;            /* global clock */<BR>-double lsttime;                        /* time used for editing */<BR>-double dtc, dts, alpha;                /* timing parameters */<BR>-int nproc;                     /* number of processors */<BR>-int barcnt;                    /* number of processors ATBARRIER */<BR>-int ncycle;                    /* number of cycles completed */<BR>-int ncycmax;                   /* number of cycles to run */<BR>-int critfree;                  /* TRUE if critical section not occupied */<BR>-int gcount;                    /* # calls to gauss */<BR>+static struct event eventtab[EVENTMX];<BR>+static struct event rtrevent;<BR>+static int waiting[EVENTMX];           /* array of waiting processors */<BR>+static int nwaiting;                   /* number of waiting processors */<BR>+static double global_time;             /* global clock */<BR>+static double lsttime;                 /* time used for editing */<BR>+static double dtc, dts, alpha;         /* timing parameters */<BR>+static int nproc;                      /* number of processors */<BR>+static int barcnt;                     /* number of processors ATBARRIER */<BR>+static int ncycle;                     /* number of cycles completed */<BR>+static int ncycmax;                    /* number of cycles to run */<BR>+static int critfree;                   /* TRUE if critical section not occupied */<BR>+static int gcount;                     /* # calls to gauss */</P>
<P> static struct event *nextevent(void);</P>
<P>diff --git a/testcases/misc/math/fptests/fptest02.c b/testcases/misc/math/fptests/fptest02.c<BR>index e6b49feb9..5bb849d65 100644<BR>--- a/testcases/misc/math/fptests/fptest02.c<BR>+++ b/testcases/misc/math/fptests/fptest02.c<BR>@@ -61,8 +61,8 @@<BR> /** LTP Port **/<BR> #include "test.h"</P>
<P>-char *TCID = "fptest02";       /* Test program identifier.    */<BR>-int TST_TOTAL = 1;             /* Total number of test cases. */<BR>+static const char *TCID = "fptest02";  /* Test program identifier.    */<BR>+static int TST_TOTAL = 1;              /* Total number of test cases. */<BR> /**************/</P>
<P> struct event {<BR>@@ -79,18 +79,18 @@ static int addevent(int, int, double);<BR> static void gaussinit(double, double, int);<BR> static double gauss(void);</P>
<P>-struct event eventtab[EVENTMX];<BR>-struct event rtrevent;<BR>-int waiting[EVENTMX];          /* array of waiting processors */<BR>-int nwaiting;                  /* number of waiting processors */<BR>-double sgtime;                 /* global clock */<BR>-double lsttime;                        /* time used for editing */<BR>-double dtc, dts, alpha;                /* timing parameters */<BR>-int nproc;                     /* number of processors */<BR>-int barcnt;                    /* number of processors ATBARRIER */<BR>-int ncycle;                    /* number of cycles completed */<BR>-int ncycmax;                   /* number of cycles to run */<BR>-int critfree;                  /* TRUE if critical section not occupied */<BR>+static struct event eventtab[EVENTMX];<BR>+static struct event rtrevent;<BR>+static int waiting[EVENTMX];           /* array of waiting processors */<BR>+static int nwaiting;                   /* number of waiting processors */<BR>+static double sgtime;                  /* global clock */<BR>+static double lsttime;                 /* time used for editing */<BR>+static double dtc, dts, alpha;         /* timing parameters */<BR>+static int nproc;                      /* number of processors */<BR>+static int barcnt;                     /* number of processors ATBARRIER */<BR>+static int ncycle;                     /* number of cycles completed */<BR>+static int ncycmax;                    /* number of cycles to run */<BR>+static int critfree;                   /* TRUE if critical section not occupied */</P>
<P> static struct event *nextevent(void );</P>
<P>diff --git a/testcases/misc/math/nextafter/nextafter01.c b/testcases/misc/math/nextafter/nextafter01.c<BR>index f4b212d4d..6faa4a7a5 100644<BR>--- a/testcases/misc/math/nextafter/nextafter01.c<BR>+++ b/testcases/misc/math/nextafter/nextafter01.c<BR>@@ -43,16 +43,16 @@<BR> #define        FAILED 0<BR> #define        PASSED 1</P>
<P>-char *TCID = "nextafter01";<BR>+static const char *TCID = "nextafter01";</P>
<P>-int local_flag = PASSED;<BR>-int block_number;<BR>-FILE *temp;<BR>-int TST_TOTAL = 1;<BR>+static int local_flag = PASSED;<BR>+static int block_number;<BR>+static FILE *temp;<BR>+static int TST_TOTAL = 1;</P>
<P>-void setup();<BR>-void blenter();<BR>-void blexit();<BR>+static void setup();<BR>+static void blenter();<BR>+static void blexit();</P>
<P> /*--------------------------------------------------------------*/<BR> int main()<BR>--<BR>2.25.1<BR></P>

<P> </P>
<P> </P>
<P> </P>
<P> </P>
<table id=bannersignimg data-cui-lock="true" namo_lock><tr><td><p> </p>
</td></tr></table><table id=confidentialsignimg data-cui-lock="true" namo_lock><tr><td><p> <img style="border: 0px solid currentColor; border-image: none; width: 520px; height: 144px; display: inline-block;" unselectable="on" data-cui-image="true" src="cid:cafe_image_0@s-core.co.kr"> </p>
</td></tr></table></BODY></HTML><table style='display: none;'><tbody><tr><td><img style='display: none;' border=0 src='http://ext.w1.samsung.net/mail/ext/v1/external/status/update?userid=k.dynowski&do=bWFpbElEPTIwMjExMTAzMTEzNDAwZXVjbXMxcDEzMmIwOWQ1OTkyMTZhMGIzYzQyZjI0ZmQ2NzBkMGM0MCZyZWNpcGllbnRBZGRyZXNzPWx0cEBsaXN0cy5saW51eC5pdA__' width=0 height=0></td></tr></tbody></table>