xref: /illumos-gate/usr/src/test/header-tests/cfg/c-symbols/README (revision ed7f95227223271d1f8b8d0dc93de13f1ed8205b)
1*ed7f9522SGordon Ross#
2*ed7f9522SGordon Ross# This file and its contents are supplied under the terms of the
3*ed7f9522SGordon Ross# Common Development and Distribution License ("CDDL"), version 1.0.
4*ed7f9522SGordon Ross# You may only use this file in accordance with the terms of version
5*ed7f9522SGordon Ross# 1.0 of the CDDL.
6*ed7f9522SGordon Ross#
7*ed7f9522SGordon Ross# A full copy of the text of the CDDL should have accompanied this
8*ed7f9522SGordon Ross# source.  A copy of the CDDL is also available via the Internet at
9*ed7f9522SGordon Ross# http://www.illumos.org/license/CDDL.
10*ed7f9522SGordon Ross#
11*ed7f9522SGordon Ross
12*ed7f9522SGordon Ross#
13*ed7f9522SGordon Ross# Copyright 2015 Garrett D'Amore <garrett@damore.org>
14*ed7f9522SGordon Ross# Copyright 2016 Joyent, Inc.
15*ed7f9522SGordon Ross#
16*ed7f9522SGordon Ross
17*ed7f9522SGordon RossThe configuration files in this directory are structured using the
18*ed7f9522SGordon Rosssyntax defined in the ../README file.  They make use of the compilation
19*ed7f9522SGordon Rossenvironments declared in ../c-symbols-env.cfg, and are processed by the
20*ed7f9522SGordon Rosssymbols test.
21*ed7f9522SGordon Ross
22*ed7f9522SGordon RossWe have organized the files by header file, that is the tests for symbols
23*ed7f9522SGordon Rossdeclared in a header file (e.g. <unistd.h> appear in a file based on that
24*ed7f9522SGordon Rossheader file's name (e.g. unistd_h.cfg.)  This is purely for convenience.
25*ed7f9522SGordon Ross
26*ed7f9522SGordon RossWithin these various declarations, we have the following field types:
27*ed7f9522SGordon Ross
28*ed7f9522SGordon Ross<envs>    This is a list of compilation environments where the symbol
29*ed7f9522SGordon Ross          should be legal.  To indicate that the symbol must not be legal
30*ed7f9522SGordon Ross          an environment group can be prefixed with "-".  For example,
31*ed7f9522SGordon Ross          "SUS+ -SUSv4+" indicates a symbol that is legal in all SUS
32*ed7f9522SGordon Ross	  environments up to SUSv3, and was removed in SUSv4 and subsequent
33*ed7f9522SGordon Ross          versions of SUS.  As you can see, we can list multiple environments
34*ed7f9522SGordon Ross          or environment groups, and we can add or remove to previous groups
35*ed7f9522SGordon Ross          with subsequent ones.
36*ed7f9522SGordon Ross
37*ed7f9522SGordon Ross<name>    This is a symbol name.  It follows the rules for C symbol names.
38*ed7f9522SGordon Ross
39*ed7f9522SGordon Ross<header>  This is a header file, for example, unistd.h.  Conventionally,
40*ed7f9522SGordon Ross          the header files used should match the file where the test is
41*ed7f9522SGordon Ross          declared.
42*ed7f9522SGordon Ross
43*ed7f9522SGordon Ross<type>    This is a C type.  Function types can be declared without their
44*ed7f9522SGordon Ross          names, e.g. "void (*)(int)".  Structures (e.g. "struct stat") and
45*ed7f9522SGordon Ross          pointer types (e.g. "pthead_t *") are legal as well.
46*ed7f9522SGordon Ross
47*ed7f9522SGordon RossHere are the types of declarations in these files:
48*ed7f9522SGordon Ross
49*ed7f9522SGordon Rosstype | <name> | <header> | <envs>
50*ed7f9522SGordon Ross
51*ed7f9522SGordon Ross    Tests for a C type with <name>.  The test verifies that a variable with
52*ed7f9522SGordon Ross    this type can be declared when the <header> is included.
53*ed7f9522SGordon Ross
54*ed7f9522SGordon Rossvalue | <name> | <type> | <header> | <envs>
55*ed7f9522SGordon Ross
56*ed7f9522SGordon Ross    Tests for a value named <name>, of type <type>.  The test attempts to
57*ed7f9522SGordon Ross    assign the given value to a scratch variable declared with the given
58*ed7f9522SGordon Ross    type.  The value can be a macro or other C symbol.
59*ed7f9522SGordon Ross
60*ed7f9522SGordon Rossdefine | <name> | <value> | <header> | <envs>
61*ed7f9522SGordon Ross
62*ed7f9522SGordon Ross    Tests for a definition named <name>.  The test verifies that the
63*ed7f9522SGordon Ross    pre-processor sees the definition.  If the <value> entry is not
64*ed7f9522SGordon Ross    empty then the check also verifies that there is strict equality
65*ed7f9522SGordon Ross    between the pre-processor value and it.  Only strict equality checks
66*ed7f9522SGordon Ross    are supported at this time.
67*ed7f9522SGordon Ross
68*ed7f9522SGordon Rossfunc | <name> | <type> | <type> [; <type> ]... | <header> | <envs>
69*ed7f9522SGordon Ross
70*ed7f9522SGordon Ross    Tests whether a function <name>, returning the first <type>, and
71*ed7f9522SGordon Ross    taking arguments of following <type> values, is declared.  Note that
72*ed7f9522SGordon Ross    the argument types are separated by semicolons.  For varargs style
73*ed7f9522SGordon Ross    functions, leave out the ... part.  For function declarations
74*ed7f9522SGordon Ross    that have no declared arguments, either void can specified, or
75*ed7f9522SGordon Ross    the type list can be omitted.
76*ed7f9522SGordon Ross
77*ed7f9522SGordon RossExamples:
78*ed7f9522SGordon Ross
79*ed7f9522SGordon Ross    type | size_t | sys/types.h | ALL
80*ed7f9522SGordon Ross    value | NULL | void * | stdlib.h | ALL
81*ed7f9522SGordon Ross    define | thread_local | | threads.h | -ALL +C11
82*ed7f9522SGordon Ross    define | __alignas_is_defined | 1 | threads.h | -ALL +C11
83*ed7f9522SGordon Ross    func | strnlen | int | const char *; int | string.h | ALL
84