On Mon, Jul 9, 2012 at 5:51 AM, Roland Mainz <[email protected]> wrote:
> Here are two of my favourite RFEs related to ISO C99 for AST:
> 1. Add a AST <bool.h> header which either defines a |bool| datatype if
> the C language level is older than C99 or uses the C99 header
> <bool.h>. I've attached an old email from the OpenSolaris PSARC
> architecture commitee which explains some reasons why having a |bool|
> is a very good idea
> 2. Access to |restrict| keyword (see
> http://developers.sun.com/solaris/articles/cc_restrict.html): Please
> add a |_ast_restrict| cpp symbol in the libast includes which defaults
> to || (=nothing) if the C language level is older than C99 or
> |restrict| if the C language level is C99 or higher, e.g. put this in
> the matching libast header:
> -- snip --
>  /*
>   * The following macro defines a value for the ISO C99 restrict
>   * keyword so that  _AST_RESTRICT resolves to "restrict" if
>   * an ISO C99 compiler is used and "" (null string) if any other
>   * compiler is used. This allows for the use of single prototype
>   * declarations regardless of compiler version.
>   */
>  #if defined(_STDC_C99))
>  #define _AST_RESTRICT restrict
>  #else
>  #define _AST_RESTRICT
>  #endif
> -- snip --
>
> ----
>
> Bye,
> Roland
>
> ---------- Forwarded message ----------
> From: Garrett  D'Amore - sun microsystems <[email protected]>
> Date: Tue, Aug 11, 2009 at 1:35 AM
> Subject: sys/stdbool.h [PSARC/2009/429 FastTrack timeout 2009/09/17]
> To: [email protected]
> Cc: [email protected]
>
>
>
> Template Version: @(#)sac_nextcase 1.68 02/23/09 SMI
> This information is Copyright 2009 Sun Microsystems
> 1. Introduction
>     1.1. Project/Component Working Name:
>          sys/stdbool.h
>     1.2. Name of Document Author/Supplier:
>          Author:  Garrett D'Amore
>     1.3  Date of This Document:
>         10 August, 2009
> 4. Technical Description
> I am sponsoring this fast track for Roland Mainz.  The case times out in one
> week (8/19/2009), and minor binding is requested.
>
>         -- Garrett
>
> 1.  Introduction
>
>    This case a new header <sys/stdbool.h> to allow kernel code
>    to use the C99 datatype "bool" and the associated values
>    "true" and "false".
>
>    The committment level of these interfaces is "Committed".
>
>    The release binding is "minor".
>
> 2.  Discussion
>
>    We need to move <stdbool.h> to <sys/stdbool.h> (and create a new
>    <stdbool.h> which sources <sys/stdbool.h>) that (new [2]) kernel
>    code can use the new C99 datatype "bool" ([1]) ?
>
>    [1]="bool" differs from the traditional kernel-land "boolean_t"
>    datatype that it is smaller (e.g. |sizeof(boolean_t)==sizeof(int)|
>    vs. |sizeof(bool)==1|) and optionally allows the compiler to do
>    better optimisations on this datatype (since it is allowed to
>    assume that it only contains "true" and "false" as values instead
>    of the full range from |INT_MIN|-|INT_MAX| for "boolean_t" (since
>    this |enum| is treated as |int| by value-range optimisations))
>    and usually reduces the size of executables (see CR #6870093).
>
>    [2]=Note that we do not intend do force developers to replace
>    "boolean_t" in existing code, only allow that new code or changes
>    (optionally) can use this C99 feature.
>
> 3.  Interface table
>
>    Interface                                      | committment level
>    -----------------------------------------------+------------------
>    <sys/stdbool.h>                                | Commited
>    C99 datatype "bool"                            | Commited
>    C99 value "true"                               | Commited
>    C99 value "false"                              | Commited
>    C99 CPP symbol "__bool_true_false_are_defined" | Commited
>
>    Notes:
>    1. <sys/stdbool.h> precisely implements the functionality for
>       <stdbool.h> defined in IEEE Std 1003.1-2001.
>    2. The ability to undefine and redefine the macros "bool",
>      "true", and "false" is an _implementation_detail_ in the ISO C
>      standard which may be withdrawn in a future version of the
>      standards specifications, kernel code shall _not_ rely on this
>      _implementation_detail_ (e.g. "#undef true", "#undef false",
>      "#undef bool" are not allowed in kernel code as they may cause
>      problems with future compiler versions).
>
> 4.  References
>    - Bugster CR #6870093 RFE: C99 <stdbool.h> should be visible for
>      kernel modules
>    - IEEE Std 1003.1-2001
>    - http://en.wikipedia.org/wiki/Stdbool.h
>    - ISO C99 draft (final document is not available for free)
>      http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf
>
> 5.  Manual page differences
>
>    None required.
>
> 6. Resources and Schedule
>     6.4. Steering Committee requested information
>         6.4.1. Consolidation C-team Name:
>                 ON
>     6.5. ARC review type: FastTrack
>     6.6. ARC Exposure: open

Erm... Glenn... I never got feedback (at least in the last 10 months)
on the |_AST_RESTRICT| part ... I'd like to craft the patch (including
switching-over some consumers) if there are no objections... I only
need the "go-head" from you (and whether _AST_RESTRICT should be
uppercase or lowercase) ...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to