mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
Ensure `wint_t' is defined before use in include/stdio.h
While trying to get nptl/tst-initializers1.c to include the test skeleton, I came across a couple of speed bumps. Firstly: after making the appropriate changes to the test, running `make check' led to this error: > In file included from ../malloc/malloc.h:24:0, .. > from tst-initializers1.c:60: > ../include/stdio.h:111:1: error: unknown type name `wint_t' > extern wint_t __getwc_unlocked (FILE *__fp); So, `wint_t' is used before being defined. Question: Why did test-skeleton.c not cause this error in any of the other tests that include it? Anyway, I noticed include/stdio.h includes stddef.h, which in turn defines `wint_t', but only if `__need_wint_t' is defined. So I put in a `#define __need_wint_t' before the include to get rid of the error. Is that the correct fix? A subsequent `make && make check' led to this second error: > from tst-initializers1-c89.c:1: > ../test-skeleton.c: In function `main': > ../test-skeleton.c:356:11: error: `for' loop initial declarations are only > allowed in C99 mode > for (struct temp_name_list *n = temp_name_list; Although there seem to be several other C89 no-noes in test-skeleton.c, I needed only to fix this specific one for gcc-4.8.3 to stop complaining.
This commit is contained in:
parent
b40a4e1a7b
commit
330fadfc62
@ -1,3 +1,9 @@
|
|||||||
|
2015-05-18 Arjun Shankar <arjun.is@lostca.se>
|
||||||
|
|
||||||
|
* include/stdio.h: Define __need_wint_t.
|
||||||
|
* test-skeleton.c: Avoid `for' loop initial declaration.
|
||||||
|
* nptl/tst-initializers1.c: Use test-skeleton.c.
|
||||||
|
|
||||||
2015-05-17 Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
2015-05-17 Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
|
||||||
[BZ #18418]
|
[BZ #18418]
|
||||||
|
@ -76,6 +76,7 @@ extern FILE *__old_tmpfile (void);
|
|||||||
|
|
||||||
|
|
||||||
# define __need_size_t
|
# define __need_size_t
|
||||||
|
# define __need_wint_t
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
/* Generate a unique file name (and possibly open it). */
|
/* Generate a unique file name (and possibly open it). */
|
||||||
extern int __path_search (char *__tmpl, size_t __tmpl_len,
|
extern int __path_search (char *__tmpl, size_t __tmpl_len,
|
||||||
|
@ -30,8 +30,8 @@ pthread_rwlock_t rwl_writer
|
|||||||
= PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP;
|
= PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP;
|
||||||
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
|
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
|
||||||
|
|
||||||
int
|
static int
|
||||||
main (void)
|
do_test (void)
|
||||||
{
|
{
|
||||||
if (mtx_normal.__data.__kind != PTHREAD_MUTEX_TIMED_NP)
|
if (mtx_normal.__data.__kind != PTHREAD_MUTEX_TIMED_NP)
|
||||||
return 1;
|
return 1;
|
||||||
@ -55,3 +55,6 @@ main (void)
|
|||||||
return 7;
|
return 7;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TEST_FUNCTION do_test ()
|
||||||
|
#include "../test-skeleton.c"
|
||||||
|
@ -352,8 +352,9 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
if (temp_name_list != NULL)
|
if (temp_name_list != NULL)
|
||||||
{
|
{
|
||||||
|
struct temp_name_list *n;
|
||||||
fprintf (f, "temp_files=(\n");
|
fprintf (f, "temp_files=(\n");
|
||||||
for (struct temp_name_list *n = temp_name_list;
|
for (n = temp_name_list;
|
||||||
n != NULL;
|
n != NULL;
|
||||||
n = (struct temp_name_list *) n->q.q_forw)
|
n = (struct temp_name_list *) n->q.q_forw)
|
||||||
fprintf (f, " '%s'\n", n->name);
|
fprintf (f, " '%s'\n", n->name);
|
||||||
|
Loading…
Reference in New Issue
Block a user