[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Compilation errors in POSIX.hdr and PTHR.hdr test sets...



These tests are Header tests for namespace pollution.
Basically POSIX and the Single UNIX Specification require that
an implementation restrict the namespace (i.e. does not make
symbols outside of the standard visible) when the standards
feature macro is defined, for example

-D_POSIX_SOURCE=199506L    /* 1996 version of POSIX.1 */
or
-D_XOPEN_SOURCE=500        /* UNIX 98, Single UNIX Spec V2 */

The header tests use a tool called hdrdefs and another tool
called hdranal. hdrdefs does essentially the same as cc -E, preprocessing
headers and creates a header.D and a header.C file
header.h.D contains either a modified version
of the header file with any #include directives it contains
expanded out, or a simple #include of headerfile.
header.h.C contains a call to a user defined check
routine chkallow() for each #defined symbol defined in the header,
protected by an #ifdef symbol.

hdranal uses the files created by hdrdefs and creates files called
header.A, header.M and header.P The .A and .M files are used in namespace
pollution tests, the .P in prototype existence tests.
The header.h.A file contains a line of the form

	    chkdecl("name");

for each declared or typedefed symbol name, and

	    chktag("name");

for each struct/union/enum tag.  The header.h.M file contains a line of
the form

	    #define name "name unprotected"<garbage-string>

for each struct/union member name.  The test code should #undef the
allowed member names after including header.h.M and before including
header.h.  The remaining defined names will cause compiler errors if
they are not protected against macro expansion in the header itself.
Looking at the signal.h.M file ,
#define tv_sec "tv_sec unprotected"))))))))))
#define tv_nsec "tv_nsec unprotected"))))))))))
#define tv_sec "tv_sec unprotected"))))))))))
#define tv_usec "tv_usec unprotected"))))))))))
#define sv_handler "sv_handler unprotected"))))))))))
#define sv_mask "sv_mask unprotected"))))))))))
#define sv_flags "sv_flags unprotected"))))))))))
#define significand "significand unprotected"))))))))))
#define exponent "exponent unprotected"))))))))))
#define significand "significand unprotected"))))))))))
#define exponent "exponent unprotected"))))))))))
#define padding "padding unprotected"))))))))))
#define element "element unprotected"))))))))))
etc
there appear to be quite a few structure tags not protected in the namespace
which could then cause the compilation error.
If its any consolation this appears to fail on all distros,
i.e they all appear to pollute the POSIX namespace.

I believe the first uses of struct timespec (tv_sec etc) can be resolved
by a POSIX interpretation, there are however a list of additional
namespace pollutants still there.

regards
Andrew

On Sep 10,  4:06pm in "Compilation errors i", Manish Kumar Srivastava wrote:
> Hi All,
>
> I am running the LSB test sets on my machine (P - III, Redhat 7.1 with
> kernel 2.4.9, glibc 2.2.4),
> in UNIX-98 mode.
>
> I am getting following problem in tset/POSIX.hdr/misc/signal/T.signal 39
> test case
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++
>
> ************************************************************************
> 	/tset/POSIX.hdr/misc/signal/T.signal 39	Failed
>
> 		Test Description:
> 	For POSIX90 and FIPS modes:
> 	    When _POSIX_SOURCE is defined and no other feature test macros
> are
> 	    defined, no other symbols than those defined or reserved by
> 	    POSIX.1-1990 are made visible.
> 	For POSIX96 mode:
> 	    When _POSIX_C_SOURCE is defined with the value 199506L and no
> 	    other feature test macros except _POSIX_SOURCE are defined, no
> 	    other symbols than those defined or reserved by POSIX.1-1996 are
> 	    made visible.
> 	For XPG4 mode:
> 	    When _XOPEN_SOURCE is defined and no other feature test macros
> 	    except _POSIX_SOURCE, _POSIX_C_SOURCE=1 or _POSIX_C_SOURCE=2 are
> 	    defined, no other symbols than those defined or reserved by XPG4
> 	    are made visible.
> 	For UNIX98 mode:
> 	    When _XOPEN_SOURCE is defined with the value 500 and no other
> 	    feature test macros except _POSIX_SOURCE or
> 	    _POSIX_C_SOURCE<=199506L are defined, no other symbols than
> those
> 	    defined or reserved by XSH5 are made visible.
> 	Posix Ref: Component C Language Definitions Assertion 2.7.2-05(B)
>
> 		Test Strategy:
> 	FOR each unreserved struct/union member made visible by the header
> 	   DEFINE a macro which will cause an error if not protected from
> 	   expansion
> 	UNDEFINE those macros which correspond to allowed member names
> 	INCLUDE a copy of the header file modified to identify #defines
>
>
> Test Agency: HCLT                                           System Tested:
> IA-32
> Test Date:   Sep 07, 2001                                        Page 196 of
> 608
>
>
>
>
>                            X/OPEN Verification Suite
>
> Test-Set Summary                                                Test-Set
> Summary
>
>
> 	FOR each unreserved symbol made visible by the header
> 	   VERIFY that the symbol name is in a list of allowed names
>
> 		Test Information:
> 	Compilation exited with non-zero value when expected to succeed
> 	Feature test macros: -D_POSIX_C_SOURCE=199506
> 	Compiler or run-time messages or results:
> 	In file included from cc39es.c:9:
> 	signal.h.D:11026: warning: no semicolon at end of struct or union
> 	signal.h.D:11026: parse error before string constant
> 	signal.h.D:11027: parse error before string constant
> 	Compilation exited with non-zero value when expected to succeed
> 	Feature test macros: -D_POSIX_C_SOURCE=199506 -D_POSIX_SOURCE
> 	Compiler or run-time messages or results:
> 	In file included from cc39es.c:9:
> 	signal.h.D:11026: warning: no semicolon at end of struct or union
> 	signal.h.D:11026: parse error before string constant
> 	signal.h.D:11027: parse error before string constant
>
>
> ************************************************************************
>
> 	Test-Set Ended:   20:55:02
>
> 	Test-Set Results Summary:
> 	------------------------
>
> 	  39  Tests Executed
> 	  18  Tests Succeeded
> 	   1  Tests Failed
> 	  20  Tests Unsupported
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++
>
> When I run the test case with -Wall option, similar error was reported for
> the file
> signal.h.D but at line no. 13167 onwards
> ++++++++++++++
> 		Test Information:
> 	Compilation exited with non-zero value when expected to succeed
> 	Feature test macros: -D_XOPEN_SOURCE=500
> 	Compiler or run-time messages or results:
> 	In file included from cc39es.c:9:
> 	signal.h.D:13167: warning: no semicolon at end of struct or union
> 	signal.h.D:13167: parse error before string constant
> 	signal.h.D:13168: parse error before string constant
> 	signal.h.D:13172: warning: no semicolon at end of struct or union
> 	signal.h.D:13172: parse error before string constant
> 	signal.h.D:13173: parse error before string constant
> 	signal.h.D:13174: parse error before string constant
> 	...
> 	...
> ++++++++++++++
>
> Similar error is observed in
> 2) tset/POSIX.hdr/misc/wait/T.wait 10
> 3) tset/PTHR.hdr/misc/pthread_5/T.pthread_5 2
>
> I tried to look into the signal.h.D file, but couldn't locate any such error
> near
> the said line nos. Hope I can get some hint from u to solve the problem.
>
> Thanks in advance
>
> Manish
>
>
> --
> To UNSUBSCRIBE, email to lsb-test-request@lists.linuxbase.org
> with subject of "unsubscribe". Trouble? Email listmaster@lists.linuxbase.org
>-- End of excerpt from Manish Kumar Srivastava




Reply to: