Home | History | Annotate | Line # | Download | only in doc
      1 This is gnat-style.info, produced by makeinfo version 6.5 from
      2 gnat-style.texi.
      3 
      4      GNAT Coding Style: A Guide for GNAT Developers , Jan 03, 2022
      5 
      6      AdaCore
      7 
      8      Copyright  2008-2022, Free Software Foundation
      9 
     10 INFO-DIR-SECTION GNU Ada Tools
     11 START-INFO-DIR-ENTRY
     12 * gnat-style: (gnat-style.info). gnat-style
     13 END-INFO-DIR-ENTRY
     14 
     15 
     16    Generated by Sphinx 4.3.1.
     17 
     18 
     19 File: gnat-style.info,  Node: Top,  Next: General,  Up: (dir)
     20 
     21 GNAT Coding Style A Guide for GNAT Developers
     22 *********************************************
     23 
     24      GNAT Coding Style: A Guide for GNAT Developers , Jan 03, 2022
     25 
     26      AdaCore
     27 
     28      Copyright  2008-2022, Free Software Foundation
     29 
     30 * Menu:
     31 
     32 * General::
     33 * Lexical Elements::
     34 * Declarations and Types::
     35 * Expressions and Names::
     36 * Statements::
     37 * Subprograms::
     38 * Packages and Visibility Rules::
     39 * Program Structure and Compilation Issues::
     40 * Index::
     41 
     42 
     43 File: gnat-style.info,  Node: General,  Next: Lexical Elements,  Prev: Top,  Up: Top
     44 
     45 1 General
     46 *********
     47 
     48 Most of GNAT is written in Ada using a consistent style to ensure
     49 readability of the code.  This document has been written to help
     50 maintain this consistent style, while having a large group of developers
     51 work on the compiler.
     52 
     53 For the coding style in the C parts of the compiler and run time, see
     54 the GNU Coding Guidelines.
     55 
     56 This document is structured after the Ada Reference Manual.  Those
     57 familiar with that document should be able to quickly lookup style rules
     58 for particular constructs.
     59 
     60 
     61 File: gnat-style.info,  Node: Lexical Elements,  Next: Declarations and Types,  Prev: General,  Up: Top
     62 
     63 2 Lexical Elements
     64 ******************
     65 
     66 * Menu:
     67 
     68 * Character Set and Separators::
     69 * Identifiers::
     70 * Numeric Literals::
     71 * Reserved Words::
     72 * Comments::
     73 
     74 
     75 File: gnat-style.info,  Node: Character Set and Separators,  Next: Identifiers,  Up: Lexical Elements
     76 
     77 2.1 Character Set and Separators
     78 ================================
     79 
     80    * The character set used should be plain 7-bit ASCII. The only
     81      separators allowed are space and the end-of-line sequence.  No
     82      other control character or format effector (such as HT, VT,
     83      FF ) should be used.  The normal end-of-line sequence is used,
     84      which may be LF, CR/LF or CR, depending on the host system.
     85      An optional SUB ( 16#1A# ) may be present as the last character
     86      in the file on hosts using that character as file terminator.
     87 
     88    * Files that are checked in or distributed should be in host format.
     89 
     90    * A line should never be longer than 79 characters, not counting the
     91      line separator.
     92 
     93    * Lines must not have trailing blanks.
     94 
     95    * Indentation is 3 characters per level for if statements, loops,
     96      and case statements.  For exact information on required spacing
     97      between lexical elements, see file style.adb.
     98 
     99 
    100 File: gnat-style.info,  Node: Identifiers,  Next: Numeric Literals,  Prev: Character Set and Separators,  Up: Lexical Elements
    101 
    102 2.2 Identifiers
    103 ===============
    104 
    105    * Identifiers will start with an upper case letter, and each letter
    106      following an underscore will be upper case.
    107 
    108      Short acronyms may be all upper case.  All other letters are lower
    109      case.  An exception is for identifiers matching a foreign language.
    110      In particular, we use all lower case where appropriate for C.
    111 
    112    * Use underscores to separate words in an identifier.
    113 
    114    * Try to limit your use of abbreviations in identifiers.  It is ok to
    115      make a few abbreviations, explain what they mean, and then use them
    116      frequently, but dont use lots of obscure abbreviations.  An
    117      example is the ALI word which stands for Ada Library Information
    118      and is by convention always written in upper-case when used in
    119      entity names.
    120 
    121           procedure Find_ALI_Files;
    122 
    123    * Dont use the variable name I, use J instead; I is too easily
    124      confused with 1 in some fonts.  Similarly dont use the variable
    125      O, which is too easily mistaken for the number 0.
    126 
    127 
    128 File: gnat-style.info,  Node: Numeric Literals,  Next: Reserved Words,  Prev: Identifiers,  Up: Lexical Elements
    129 
    130 2.3 Numeric Literals
    131 ====================
    132 
    133    * Numeric literals should include underscores where helpful for
    134      readability.
    135 
    136           1_000_000
    137           16#8000_0000#
    138           3.14159_26535_89793_23846
    139 
    140 
    141 File: gnat-style.info,  Node: Reserved Words,  Next: Comments,  Prev: Numeric Literals,  Up: Lexical Elements
    142 
    143 2.4 Reserved Words
    144 ==================
    145 
    146    * Reserved words use all lower case.
    147 
    148           return else
    149 
    150    * The words Access, Delta and Digits are capitalized when used
    151      as attribute_designator.
    152 
    153 
    154 File: gnat-style.info,  Node: Comments,  Prev: Reserved Words,  Up: Lexical Elements
    155 
    156 2.5 Comments
    157 ============
    158 
    159    * A comment starts with -- followed by two spaces.  The only
    160      exception to this rule (i.e.  one space is tolerated) is when the
    161      comment ends with a single space followed by --.  It is also
    162      acceptable to have only one space between -- and the start of the
    163      comment when the comment is at the end of a line, after some Ada
    164      code.
    165 
    166    * Every sentence in a comment should start with an upper-case letter
    167      (including the first letter of the comment).
    168 
    169    * When declarations are commented with hanging comments, i.e.
    170      comments after the declaration, there is no blank line before the
    171      comment, and if it is absolutely necessary to have blank lines
    172      within the comments, e.g.  to make paragraph separations within a
    173      single comment, these blank lines `do' have a -- (unlike the
    174      normal rule, which is to use entirely blank lines for separating
    175      comment paragraphs).  The comment starts at same level of
    176      indentation as code it is commenting.
    177 
    178           z : Integer;
    179           --  Integer value for storing value of z
    180           --
    181           --  The previous line was a blank line.
    182 
    183    * Comments that are dubious or incomplete, or that comment on
    184      possibly wrong or incomplete code, should be preceded or followed
    185      by ???.
    186 
    187    * Comments in a subprogram body must generally be surrounded by blank
    188      lines.  An exception is a comment that follows a line containing a
    189      single keyword ( begin, else, loop ):
    190 
    191           begin
    192              --  Comment for the next statement
    193 
    194              A := 5;
    195 
    196              --  Comment for the B statement
    197 
    198              B := 6;
    199           end;
    200 
    201    * In sequences of statements, comments at the end of the lines should
    202      be aligned.
    203 
    204           My_Identifier := 5;      --  First comment
    205           Other_Id := 6;           --  Second comment
    206 
    207    * Short comments that fit on a single line are `not' ended with a
    208      period.  Comments taking more than a line are punctuated in the
    209      normal manner.
    210 
    211    * Comments should focus on `why' instead of `what'.  Descriptions of
    212      what subprograms do go with the specification.
    213 
    214    * Comments describing a subprogram spec should specifically mention
    215      the formal argument names.  General rule: write a comment that does
    216      not depend on the names of things.  The names are supplementary,
    217      not sufficient, as comments.
    218 
    219    * `Do not' put two spaces after periods in comments.
    220 
    221 
    222 File: gnat-style.info,  Node: Declarations and Types,  Next: Expressions and Names,  Prev: Lexical Elements,  Up: Top
    223 
    224 3 Declarations and Types
    225 ************************
    226 
    227    * In entity declarations, colons must be surrounded by spaces.
    228      Colons should be aligned.
    229 
    230           Entity1   : Integer;
    231           My_Entity : Integer;
    232 
    233    * Declarations should be grouped in a logical order.  Related groups
    234      of declarations may be preceded by a header comment.
    235 
    236    * All local subprograms in a subprogram or package body should be
    237      declared before the first local subprogram body.
    238 
    239    * Do not declare local entities that hide global entities.
    240 
    241    * Do not declare multiple variables in one declaration that spans
    242      lines.  Start a new declaration on each line, instead.
    243 
    244    * The defining_identifiers of global declarations serve as comments
    245      of a sort.  So dont choose terse names, but look for names that
    246      give useful information instead.
    247 
    248    * Local names can be shorter, because they are used only within one
    249      context, where comments explain their purpose.
    250 
    251    * When starting an initialization or default expression on the line
    252      that follows the declaration line, use 2 characters for
    253      indentation.
    254 
    255           Entity1 : Integer :=
    256             Function_Name (Parameters, For_Call);
    257 
    258    * If an initialization or default expression needs to be continued on
    259      subsequent lines, the continuations should be indented from the
    260      start of the expression.
    261 
    262           Entity1 : Integer := Long_Function_Name
    263                                  (parameters for call);
    264 
    265 
    266 File: gnat-style.info,  Node: Expressions and Names,  Next: Statements,  Prev: Declarations and Types,  Up: Top
    267 
    268 4 Expressions and Names
    269 ***********************
    270 
    271    * Every operator must be surrounded by spaces.  An exception is that
    272      this rule does not apply to the exponentiation operator, for which
    273      there are no specific layout rules.  The reason for this exception
    274      is that sometimes it makes clearer reading to leave out the spaces
    275      around exponentiation.
    276 
    277           E := A * B**2 + 3 * (C - D);
    278 
    279    * Use parentheses where they clarify the intended association of
    280      operands with operators:
    281 
    282           (A / B) * C
    283 
    284 
    285 File: gnat-style.info,  Node: Statements,  Next: Subprograms,  Prev: Expressions and Names,  Up: Top
    286 
    287 5 Statements
    288 ************
    289 
    290 * Menu:
    291 
    292 * Simple and Compound Statements::
    293 * If Statements::
    294 * Case Statements::
    295 * Loop Statements::
    296 * Block Statements::
    297 
    298 
    299 File: gnat-style.info,  Node: Simple and Compound Statements,  Next: If Statements,  Up: Statements
    300 
    301 5.1 Simple and Compound Statements
    302 ==================================
    303 
    304    * Use only one statement or label per line.
    305 
    306    * A longer sequence_of_statements may be divided in logical groups or
    307      separated from surrounding code using a blank line.
    308 
    309 
    310 File: gnat-style.info,  Node: If Statements,  Next: Case Statements,  Prev: Simple and Compound Statements,  Up: Statements
    311 
    312 5.2 If Statements
    313 =================
    314 
    315    * When the if, elsif or else keywords fit on the same line with
    316      the condition and the then keyword, then the statement is
    317      formatted as follows:
    318 
    319           if condition then
    320              ...
    321           elsif condition then
    322              ...
    323           else
    324              ...
    325           end if;
    326 
    327      When the above layout is not possible, then should be aligned
    328      with if, and conditions should preferably be split before an
    329      and or or keyword a follows:
    330 
    331           if long_condition_that_has_to_be_split
    332             and then continued_on_the_next_line
    333           then
    334              ...
    335           end if;
    336 
    337      The elsif, else and end if always line up with the if
    338      keyword.  The preferred location for splitting the line is before
    339      and or or.  The continuation of a condition is indented with
    340      two spaces or as many as needed to make nesting clear.  As an
    341      exception, if conditions are closely related either of the
    342      following is allowed:
    343 
    344           if x = lakdsjfhlkashfdlkflkdsalkhfsalkdhflkjdsahf
    345                or else
    346              x = asldkjhalkdsjfhhfd
    347                or else
    348              x = asdfadsfadsf
    349           then
    350             ...
    351           end if;
    352 
    353           if x = lakdsjfhlkashfdlkflkdsalkhfsalkdhflkjdsahf or else
    354              x = asldkjhalkdsjfhhfd                         or else
    355              x = asdfadsfadsf
    356           then
    357             ...
    358           end if;
    359 
    360    * Conditions should use short-circuit forms ( and then, or else
    361      ), except when the operands are boolean variables or boolean
    362      constants.
    363 
    364    * Complex conditions in if statements are indented two characters:
    365 
    366           if this_complex_condition
    367             and then that_other_one
    368             and then one_last_one
    369           then
    370              ...
    371           end if;
    372 
    373      There are some cases where complex conditionals can be laid out in
    374      manners that do not follow these rules to preserve better
    375      parallelism between branches, e.g.
    376 
    377           if xyz.abc (gef) = 'c'
    378                or else
    379              xyz.abc (gef) = 'x'
    380           then
    381              ...
    382           end if;
    383 
    384    * Every if block is preceded and followed by a blank line, except
    385      where it begins or ends a sequence_of_statements.
    386 
    387           A := 5;
    388 
    389           if A = 5 then
    390              null;
    391           end if;
    392 
    393           A := 6;
    394 
    395 
    396 File: gnat-style.info,  Node: Case Statements,  Next: Loop Statements,  Prev: If Statements,  Up: Statements
    397 
    398 5.3 Case Statements
    399 ===================
    400 
    401    * Layout is as below.  For long case statements, the extra
    402      indentation can be saved by aligning the when clauses with the
    403      opening case.
    404 
    405           case expression is
    406              when condition =>
    407                 ...
    408              when condition =>
    409                 ...
    410           end case;
    411 
    412 
    413 File: gnat-style.info,  Node: Loop Statements,  Next: Block Statements,  Prev: Case Statements,  Up: Statements
    414 
    415 5.4 Loop Statements
    416 ===================
    417 
    418    * When possible, have for or while on one line with the condition
    419      and the loop keyword.
    420 
    421           for J in S'Range loop
    422              ...
    423           end loop;
    424 
    425      If the condition is too long, split the condition (see If
    426      statements above) and align loop with the for or while
    427      keyword.
    428 
    429           while long_condition_that_has_to_be_split
    430             and then continued_on_the_next_line
    431           loop
    432              ...
    433           end loop;
    434 
    435      If the loop_statement has an identifier, it is laid out as follows:
    436 
    437           Outer : while not condition loop
    438              ...
    439           end Outer;
    440 
    441 
    442 File: gnat-style.info,  Node: Block Statements,  Prev: Loop Statements,  Up: Statements
    443 
    444 5.5 Block Statements
    445 ====================
    446 
    447    * The declare (optional), begin and end words are aligned,
    448      except when the block_statement is named.  There is a blank line
    449      before the begin keyword:
    450 
    451           Some_Block : declare
    452              ...
    453 
    454           begin
    455              ...
    456           end Some_Block;
    457 
    458 
    459 File: gnat-style.info,  Node: Subprograms,  Next: Packages and Visibility Rules,  Prev: Statements,  Up: Top
    460 
    461 6 Subprograms
    462 *************
    463 
    464 * Menu:
    465 
    466 * Subprogram Declarations::
    467 * Subprogram Bodies::
    468 
    469 
    470 File: gnat-style.info,  Node: Subprogram Declarations,  Next: Subprogram Bodies,  Up: Subprograms
    471 
    472 6.1 Subprogram Declarations
    473 ===========================
    474 
    475    * Do not write the in for parameters.
    476 
    477           function Length (S : String) return Integer;
    478 
    479    * When the declaration line for a procedure or a function is too long
    480      to fit the entire declaration (including the keyword procedure or
    481      function) on a single line, then fold it, putting a single
    482      parameter on a line, aligning the colons, as in:
    483 
    484           procedure Set_Heading
    485             (Source : String;
    486              Count  : Natural;
    487              Pad    : Character := Space;
    488              Fill   : Boolean   := True);
    489 
    490      In the case of a function, if the entire spec does not fit on one
    491      line, then the return may appear after the last parameter, as in:
    492 
    493           function Head
    494             (Source : String;
    495              Count  : Natural;
    496              Pad    : Character := Space) return String;
    497 
    498      Or it may appear on its own as a separate line.  This form is
    499      preferred when putting the return on the same line as the last
    500      parameter would result in an overlong line.  The return type may
    501      optionally be aligned with the types of the parameters (usually we
    502      do this aligning if it results only in a small number of extra
    503      spaces, and otherwise we dont attempt to align).  So two
    504      alternative forms for the above spec are:
    505 
    506           function Head
    507             (Source : String;
    508              Count  : Natural;
    509              Pad    : Character := Space)
    510              return   String;
    511 
    512           function Head
    513             (Source : String;
    514              Count  : Natural;
    515              Pad    : Character := Space)
    516              return String;
    517 
    518 
    519 File: gnat-style.info,  Node: Subprogram Bodies,  Prev: Subprogram Declarations,  Up: Subprograms
    520 
    521 6.2 Subprogram Bodies
    522 =====================
    523 
    524    * Function and procedure bodies should usually be sorted
    525      alphabetically.  Do not attempt to sort them in some logical order
    526      by functionality.  For a sequence of subprogram specs, a general
    527      alphabetical sorting is also usually appropriate, but occasionally
    528      it makes sense to group by major function, with appropriate
    529      headers.
    530 
    531    * All subprograms have a header giving the function name, with the
    532      following format:
    533 
    534           -----------------
    535           -- My_Function --
    536           -----------------
    537 
    538           procedure My_Function is
    539           begin
    540             ...
    541           end My_Function;
    542 
    543      Note that the name in the header is preceded by a single space, not
    544      two spaces as for other comments.  These headers are used on nested
    545      subprograms as well as outer level subprograms.  They may also be
    546      used as headers for sections of comments, or collections of
    547      declarations that are related.
    548 
    549    * Every subprogram body must have a preceding subprogram_declaration,
    550      which includes proper client documentation so that you do not need
    551      to read the subprogram body in order to understand what the
    552      subprogram does and how to call it.  All subprograms should be
    553      documented, without exceptions.
    554 
    555    * A sequence of declarations may optionally be separated from the
    556      following begin by a blank line.  Just as we optionally allow blank
    557      lines in general between declarations, this blank line should be
    558      present only if it improves readability.  Generally we avoid this
    559      blank line if the declarative part is small (one or two lines) and
    560      the body has no blank lines, and we include it if the declarative
    561      part is long or if the body has blank lines.
    562 
    563    * If the declarations in a subprogram contain at least one nested
    564      subprogram body, then just before the begin of the enclosing
    565      subprogram, there is a comment line and a blank line:
    566 
    567           --  Start of processing for Enclosing_Subprogram
    568 
    569           begin
    570             ...
    571           end Enclosing_Subprogram;
    572 
    573    * When nested subprograms are present, variables that are referenced
    574      by any nested subprogram should precede the nested subprogram
    575      specs.  For variables that are not referenced by nested procedures,
    576      the declarations can either also be before any of the nested
    577      subprogram specs (this is the old style, more generally used).  Or
    578      then can come just before the begin, with a header.  The following
    579      example shows the two possible styles:
    580 
    581           procedure Style1 is
    582              Var_Referenced_In_Nested      : Integer;
    583              Var_Referenced_Only_In_Style1 : Integer;
    584 
    585              proc Nested;
    586              --  Comments ...
    587 
    588              ------------
    589              -- Nested --
    590              ------------
    591 
    592              procedure Nested is
    593              begin
    594                 ...
    595              end Nested;
    596 
    597           --  Start of processing for Style1
    598 
    599           begin
    600              ...
    601           end Style1;
    602 
    603           procedure Style2 is
    604              Var_Referenced_In_Nested : Integer;
    605 
    606              proc Nested;
    607              --  Comments ...
    608 
    609              ------------
    610              -- Nested --
    611              ------------
    612 
    613              procedure Nested is
    614              begin
    615                 ...
    616              end Nested;
    617 
    618              --  Local variables
    619 
    620              Var_Referenced_Only_In_Style2 : Integer;
    621 
    622           --  Start of processing for Style2
    623 
    624           begin
    625              ...
    626           end Style2;
    627 
    628      For new code, we generally prefer Style2, but we do not insist on
    629      modifying all legacy occurrences of Style1, which is still much
    630      more common in the sources.
    631 
    632 
    633 File: gnat-style.info,  Node: Packages and Visibility Rules,  Next: Program Structure and Compilation Issues,  Prev: Subprograms,  Up: Top
    634 
    635 7 Packages and Visibility Rules
    636 *******************************
    637 
    638    * All program units and subprograms have their name at the end:
    639 
    640           package P is
    641              ...
    642           end P;
    643 
    644    * We will use the style of use -ing with -ed packages, with the
    645      context clauses looking like:
    646 
    647           with A; use A;
    648           with B; use B;
    649 
    650    * Names declared in the visible part of packages should be unique, to
    651      prevent name clashes when the packages are use d.
    652 
    653           package Entity is
    654              type Entity_Kind is ...;
    655              ...
    656           end Entity;
    657 
    658    * After the file header comment, the context clause and unit
    659      specification should be the first thing in a program_unit.
    660 
    661    * Preelaborate, Pure and Elaborate_Body pragmas should be added right
    662      after the package name, indented an extra level and using the
    663      parameterless form:
    664 
    665           package Preelaborate_Package is
    666              pragma Preelaborate;
    667              ...
    668           end Preelaborate_Package;
    669 
    670 
    671 File: gnat-style.info,  Node: Program Structure and Compilation Issues,  Next: Index,  Prev: Packages and Visibility Rules,  Up: Top
    672 
    673 8 Program Structure and Compilation Issues
    674 ******************************************
    675 
    676    * Every GNAT source file must be compiled with the -gnatg switch to
    677      check the coding style.  (Note that you should look at style.adb to
    678      see the lexical rules enforced by -gnatg ).
    679 
    680    * Each source file should contain only one compilation unit.
    681 
    682    * Filenames should be 8 or fewer characters, followed by the .adb
    683      extension for a body or .ads for a spec.
    684 
    685    * Unit names should be distinct when krunched to 8 characters (see
    686      krunch.ads) and the filenames should match the unit name, except
    687      that they are all lower case.
    688 
    689 * Menu:
    690 
    691 * GNU Free Documentation License::
    692 
    693 
    694 File: gnat-style.info,  Node: GNU Free Documentation License,  Up: Program Structure and Compilation Issues
    695 
    696 8.1 GNU Free Documentation License
    697 ==================================
    698 
    699 Version 1.3, 3 November 2008
    700 
    701 Copyright 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc
    702 https://fsf.org/
    703 
    704 Everyone is permitted to copy and distribute verbatim copies of this
    705 license document, but changing it is not allowed.
    706 
    707 `Preamble'
    708 
    709 The purpose of this License is to make a manual, textbook, or other
    710 functional and useful document free in the sense of freedom: to assure
    711 everyone the effective freedom to copy and redistribute it, with or
    712 without modifying it, either commercially or noncommercially.
    713 Secondarily, this License preserves for the author and publisher a way
    714 to get credit for their work, while not being considered responsible for
    715 modifications made by others.
    716 
    717 This License is a kind of copyleft, which means that derivative works
    718 of the document must themselves be free in the same sense.  It
    719 complements the GNU General Public License, which is a copyleft license
    720 designed for free software.
    721 
    722 We have designed this License in order to use it for manuals for free
    723 software, because free software needs free documentation: a free program
    724 should come with manuals providing the same freedoms that the software
    725 does.  But this License is not limited to software manuals; it can be
    726 used for any textual work, regardless of subject matter or whether it is
    727 published as a printed book.  We recommend this License principally for
    728 works whose purpose is instruction or reference.
    729 
    730 `1.  APPLICABILITY AND DEFINITIONS'
    731 
    732 This License applies to any manual or other work, in any medium, that
    733 contains a notice placed by the copyright holder saying it can be
    734 distributed under the terms of this License.  Such a notice grants a
    735 world-wide, royalty-free license, unlimited in duration, to use that
    736 work under the conditions stated herein.  The `Document', below, refers
    737 to any such manual or work.  Any member of the public is a licensee, and
    738 is addressed as `you'.  You accept the license if you copy, modify or
    739 distribute the work in a way requiring permission under copyright law.
    740 
    741 A `Modified Version' of the Document means any work containing the
    742 Document or a portion of it, either copied verbatim, or with
    743 modifications and/or translated into another language.
    744 
    745 A `Secondary Section' is a named appendix or a front-matter section of
    746 the Document that deals exclusively with the relationship of the
    747 publishers or authors of the Document to the Documents overall subject
    748 (or to related matters) and contains nothing that could fall directly
    749 within that overall subject.  (Thus, if the Document is in part a
    750 textbook of mathematics, a Secondary Section may not explain any
    751 mathematics.)  The relationship could be a matter of historical
    752 connection with the subject or with related matters, or of legal,
    753 commercial, philosophical, ethical or political position regarding them.
    754 
    755 The `Invariant Sections' are certain Secondary Sections whose titles
    756 are designated, as being those of Invariant Sections, in the notice that
    757 says that the Document is released under this License.  If a section
    758 does not fit the above definition of Secondary then it is not allowed to
    759 be designated as Invariant.  The Document may contain zero Invariant
    760 Sections.  If the Document does not identify any Invariant Sections then
    761 there are none.
    762 
    763 The `Cover Texts' are certain short passages of text that are listed,
    764 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
    765 the Document is released under this License.  A Front-Cover Text may be
    766 at most 5 words, and a Back-Cover Text may be at most 25 words.
    767 
    768 A `Transparent' copy of the Document means a machine-readable copy,
    769 represented in a format whose specification is available to the general
    770 public, that is suitable for revising the document straightforwardly
    771 with generic text editors or (for images composed of pixels) generic
    772 paint programs or (for drawings) some widely available drawing editor,
    773 and that is suitable for input to text formatters or for automatic
    774 translation to a variety of formats suitable for input to text
    775 formatters.  A copy made in an otherwise Transparent file format whose
    776 markup, or absence of markup, has been arranged to thwart or discourage
    777 subsequent modification by readers is not Transparent.  An image format
    778 is not Transparent if used for any substantial amount of text.  A copy
    779 that is not Transparent is called `Opaque'.
    780 
    781 Examples of suitable formats for Transparent copies include plain ASCII
    782 without markup, Texinfo input format, LaTeX input format, SGML or XML
    783 using a publicly available DTD, and standard-conforming simple HTML,
    784 PostScript or PDF designed for human modification.  Examples of
    785 transparent image formats include PNG, XCF and JPG. Opaque formats
    786 include proprietary formats that can be read and edited only by
    787 proprietary word processors, SGML or XML for which the DTD and/or
    788 processing tools are not generally available, and the machine-generated
    789 HTML, PostScript or PDF produced by some word processors for output
    790 purposes only.
    791 
    792 The `Title Page' means, for a printed book, the title page itself,
    793 plus such following pages as are needed to hold, legibly, the material
    794 this License requires to appear in the title page.  For works in formats
    795 which do not have any title page as such, Title Page means the text
    796 near the most prominent appearance of the works title, preceding the
    797 beginning of the body of the text.
    798 
    799 The `publisher' means any person or entity that distributes copies of
    800 the Document to the public.
    801 
    802 A section `Entitled XYZ' means a named subunit of the Document whose
    803 title either is precisely XYZ or contains XYZ in parentheses following
    804 text that translates XYZ in another language.  (Here XYZ stands for a
    805 specific section name mentioned below, such as `Acknowledgements',
    806 `Dedications', `Endorsements', or `History'.)  To `Preserve the
    807 Title' of such a section when you modify the Document means that it
    808 remains a section Entitled XYZ according to this definition.
    809 
    810 The Document may include Warranty Disclaimers next to the notice which
    811 states that this License applies to the Document.  These Warranty
    812 Disclaimers are considered to be included by reference in this License,
    813 but only as regards disclaiming warranties: any other implication that
    814 these Warranty Disclaimers may have is void and has no effect on the
    815 meaning of this License.
    816 
    817 `2.  VERBATIM COPYING'
    818 
    819 You may copy and distribute the Document in any medium, either
    820 commercially or noncommercially, provided that this License, the
    821 copyright notices, and the license notice saying this License applies to
    822 the Document are reproduced in all copies, and that you add no other
    823 conditions whatsoever to those of this License.  You may not use
    824 technical measures to obstruct or control the reading or further copying
    825 of the copies you make or distribute.  However, you may accept
    826 compensation in exchange for copies.  If you distribute a large enough
    827 number of copies you must also follow the conditions in section 3.
    828 
    829 You may also lend copies, under the same conditions stated above, and
    830 you may publicly display copies.
    831 
    832 `3.  COPYING IN QUANTITY'
    833 
    834 If you publish printed copies (or copies in media that commonly have
    835 printed covers) of the Document, numbering more than 100, and the
    836 Documents license notice requires Cover Texts, you must enclose the
    837 copies in covers that carry, clearly and legibly, all these Cover Texts:
    838 Front-Cover Texts on the front cover, and Back-Cover Texts on the back
    839 cover.  Both covers must also clearly and legibly identify you as the
    840 publisher of these copies.  The front cover must present the full title
    841 with all words of the title equally prominent and visible.  You may add
    842 other material on the covers in addition.  Copying with changes limited
    843 to the covers, as long as they preserve the title of the Document and
    844 satisfy these conditions, can be treated as verbatim copying in other
    845 respects.
    846 
    847 If the required texts for either cover are too voluminous to fit
    848 legibly, you should put the first ones listed (as many as fit
    849 reasonably) on the actual cover, and continue the rest onto adjacent
    850 pages.
    851 
    852 If you publish or distribute Opaque copies of the Document numbering
    853 more than 100, you must either include a machine-readable Transparent
    854 copy along with each Opaque copy, or state in or with each Opaque copy a
    855 computer-network location from which the general network-using public
    856 has access to download using public-standard network protocols a
    857 complete Transparent copy of the Document, free of added material.  If
    858 you use the latter option, you must take reasonably prudent steps, when
    859 you begin distribution of Opaque copies in quantity, to ensure that this
    860 Transparent copy will remain thus accessible at the stated location
    861 until at least one year after the last time you distribute an Opaque
    862 copy (directly or through your agents or retailers) of that edition to
    863 the public.
    864 
    865 It is requested, but not required, that you contact the authors of the
    866 Document well before redistributing any large number of copies, to give
    867 them a chance to provide you with an updated version of the Document.
    868 
    869 `4.  MODIFICATIONS'
    870 
    871 You may copy and distribute a Modified Version of the Document under the
    872 conditions of sections 2 and 3 above, provided that you release the
    873 Modified Version under precisely this License, with the Modified Version
    874 filling the role of the Document, thus licensing distribution and
    875 modification of the Modified Version to whoever possesses a copy of it.
    876 In addition, you must do these things in the Modified Version:
    877 
    878   A. Use in the Title Page (and on the covers, if any) a title distinct
    879      from that of the Document, and from those of previous versions
    880      (which should, if there were any, be listed in the History section
    881      of the Document).  You may use the same title as a previous version
    882      if the original publisher of that version gives permission.
    883 
    884   B. List on the Title Page, as authors, one or more persons or entities
    885      responsible for authorship of the modifications in the Modified
    886      Version, together with at least five of the principal authors of
    887      the Document (all of its principal authors, if it has fewer than
    888      five), unless they release you from this requirement.
    889 
    890   C. State on the Title page the name of the publisher of the Modified
    891      Version, as the publisher.
    892 
    893   D. Preserve all the copyright notices of the Document.
    894 
    895   E. Add an appropriate copyright notice for your modifications adjacent
    896      to the other copyright notices.
    897 
    898   F. Include, immediately after the copyright notices, a license notice
    899      giving the public permission to use the Modified Version under the
    900      terms of this License, in the form shown in the Addendum below.
    901 
    902   G. Preserve in that license notice the full lists of Invariant
    903      Sections and required Cover Texts given in the Documents license
    904      notice.
    905 
    906   H. Include an unaltered copy of this License.
    907 
    908   I. Preserve the section Entitled History, Preserve its Title, and
    909      add to it an item stating at least the title, year, new authors,
    910      and publisher of the Modified Version as given on the Title Page.
    911      If there is no section Entitled History in the Document, create
    912      one stating the title, year, authors, and publisher of the Document
    913      as given on its Title Page, then add an item describing the
    914      Modified Version as stated in the previous sentence.
    915 
    916   J. Preserve the network location, if any, given in the Document for
    917      public access to a Transparent copy of the Document, and likewise
    918      the network locations given in the Document for previous versions
    919      it was based on.  These may be placed in the History section.
    920      You may omit a network location for a work that was published at
    921      least four years before the Document itself, or if the original
    922      publisher of the version it refers to gives permission.
    923 
    924   K. For any section Entitled Acknowledgements or Dedications,
    925      Preserve the Title of the section, and preserve in the section all
    926      the substance and tone of each of the contributor acknowledgements
    927      and/or dedications given therein.
    928 
    929   L. Preserve all the Invariant Sections of the Document, unaltered in
    930      their text and in their titles.  Section numbers or the equivalent
    931      are not considered part of the section titles.
    932 
    933   M. Delete any section Entitled Endorsements.  Such a section may not
    934      be included in the Modified Version.
    935 
    936   N. Do not retitle any existing section to be Entitled Endorsements
    937      or to conflict in title with any Invariant Section.
    938 
    939   O. Preserve any Warranty Disclaimers.
    940 
    941 If the Modified Version includes new front-matter sections or appendices
    942 that qualify as Secondary Sections and contain no material copied from
    943 the Document, you may at your option designate some or all of these
    944 sections as invariant.  To do this, add their titles to the list of
    945 Invariant Sections in the Modified Versions license notice.  These
    946 titles must be distinct from any other section titles.
    947 
    948 You may add a section Entitled Endorsements, provided it contains
    949 nothing but endorsements of your Modified Version by various partiesfor
    950 example, statements of peer review or that the text has been approved by
    951 an organization as the authoritative definition of a standard.
    952 
    953 You may add a passage of up to five words as a Front-Cover Text, and a
    954 passage of up to 25 words as a Back-Cover Text, to the end of the list
    955 of Cover Texts in the Modified Version.  Only one passage of Front-Cover
    956 Text and one of Back-Cover Text may be added by (or through arrangements
    957 made by) any one entity.  If the Document already includes a cover text
    958 for the same cover, previously added by you or by arrangement made by
    959 the same entity you are acting on behalf of, you may not add another;
    960 but you may replace the old one, on explicit permission from the
    961 previous publisher that added the old one.
    962 
    963 The author(s) and publisher(s) of the Document do not by this License
    964 give permission to use their names for publicity for or to assert or
    965 imply endorsement of any Modified Version.
    966 
    967 `5.  COMBINING DOCUMENTS'
    968 
    969 You may combine the Document with other documents released under this
    970 License, under the terms defined in section 4 above for modified
    971 versions, provided that you include in the combination all of the
    972 Invariant Sections of all of the original documents, unmodified, and
    973 list them all as Invariant Sections of your combined work in its license
    974 notice, and that you preserve all their Warranty Disclaimers.
    975 
    976 The combined work need only contain one copy of this License, and
    977 multiple identical Invariant Sections may be replaced with a single
    978 copy.  If there are multiple Invariant Sections with the same name but
    979 different contents, make the title of each such section unique by adding
    980 at the end of it, in parentheses, the name of the original author or
    981 publisher of that section if known, or else a unique number.  Make the
    982 same adjustment to the section titles in the list of Invariant Sections
    983 in the license notice of the combined work.
    984 
    985 In the combination, you must combine any sections Entitled History in
    986 the various original documents, forming one section Entitled History;
    987 likewise combine any sections Entitled Acknowledgements, and any
    988 sections Entitled Dedications.  You must delete all sections Entitled
    989 Endorsements.
    990 
    991 `6.  COLLECTIONS OF DOCUMENTS'
    992 
    993 You may make a collection consisting of the Document and other documents
    994 released under this License, and replace the individual copies of this
    995 License in the various documents with a single copy that is included in
    996 the collection, provided that you follow the rules of this License for
    997 verbatim copying of each of the documents in all other respects.
    998 
    999 You may extract a single document from such a collection, and distribute
   1000 it individually under this License, provided you insert a copy of this
   1001 License into the extracted document, and follow this License in all
   1002 other respects regarding verbatim copying of that document.
   1003 
   1004 `7.  AGGREGATION WITH INDEPENDENT WORKS'
   1005 
   1006 A compilation of the Document or its derivatives with other separate and
   1007 independent documents or works, in or on a volume of a storage or
   1008 distribution medium, is called an aggregate if the copyright resulting
   1009 from the compilation is not used to limit the legal rights of the
   1010 compilations users beyond what the individual works permit.  When the
   1011 Document is included in an aggregate, this License does not apply to the
   1012 other works in the aggregate which are not themselves derivative works
   1013 of the Document.
   1014 
   1015 If the Cover Text requirement of section 3 is applicable to these copies
   1016 of the Document, then if the Document is less than one half of the
   1017 entire aggregate, the Documents Cover Texts may be placed on covers
   1018 that bracket the Document within the aggregate, or the electronic
   1019 equivalent of covers if the Document is in electronic form.  Otherwise
   1020 they must appear on printed covers that bracket the whole aggregate.
   1021 
   1022 `8.  TRANSLATION'
   1023 
   1024 Translation is considered a kind of modification, so you may distribute
   1025 translations of the Document under the terms of section 4.  Replacing
   1026 Invariant Sections with translations requires special permission from
   1027 their copyright holders, but you may include translations of some or all
   1028 Invariant Sections in addition to the original versions of these
   1029 Invariant Sections.  You may include a translation of this License, and
   1030 all the license notices in the Document, and any Warranty Disclaimers,
   1031 provided that you also include the original English version of this
   1032 License and the original versions of those notices and disclaimers.  In
   1033 case of a disagreement between the translation and the original version
   1034 of this License or a notice or disclaimer, the original version will
   1035 prevail.
   1036 
   1037 If a section in the Document is Entitled Acknowledgements,
   1038 Dedications, or History, the requirement (section 4) to Preserve its
   1039 Title (section 1) will typically require changing the actual title.
   1040 
   1041 `9.  TERMINATION'
   1042 
   1043 You may not copy, modify, sublicense, or distribute the Document except
   1044 as expressly provided under this License.  Any attempt otherwise to
   1045 copy, modify, sublicense, or distribute it is void, and will
   1046 automatically terminate your rights under this License.
   1047 
   1048 However, if you cease all violation of this License, then your license
   1049 from a particular copyright holder is reinstated (a) provisionally,
   1050 unless and until the copyright holder explicitly and finally terminates
   1051 your license, and (b) permanently, if the copyright holder fails to
   1052 notify you of the violation by some reasonable means prior to 60 days
   1053 after the cessation.
   1054 
   1055 Moreover, your license from a particular copyright holder is reinstated
   1056 permanently if the copyright holder notifies you of the violation by
   1057 some reasonable means, this is the first time you have received notice
   1058 of violation of this License (for any work) from that copyright holder,
   1059 and you cure the violation prior to 30 days after your receipt of the
   1060 notice.
   1061 
   1062 Termination of your rights under this section does not terminate the
   1063 licenses of parties who have received copies or rights from you under
   1064 this License.  If your rights have been terminated and not permanently
   1065 reinstated, receipt of a copy of some or all of the same material does
   1066 not give you any rights to use it.
   1067 
   1068 `10.  FUTURE REVISIONS OF THIS LICENSE'
   1069 
   1070 The Free Software Foundation may publish new, revised versions of the
   1071 GNU Free Documentation License from time to time.  Such new versions
   1072 will be similar in spirit to the present version, but may differ in
   1073 detail to address new problems or concerns.  See
   1074 https://www.gnu.org/copyleft/.
   1075 
   1076 Each version of the License is given a distinguishing version number.
   1077 If the Document specifies that a particular numbered version of this
   1078 License or any later version applies to it, you have the option of
   1079 following the terms and conditions either of that specified version or
   1080 of any later version that has been published (not as a draft) by the
   1081 Free Software Foundation.  If the Document does not specify a version
   1082 number of this License, you may choose any version ever published (not
   1083 as a draft) by the Free Software Foundation.  If the Document specifies
   1084 that a proxy can decide which future versions of this License can be
   1085 used, that proxys public statement of acceptance of a version
   1086 permanently authorizes you to choose that version for the Document.
   1087 
   1088 `11.  RELICENSING'
   1089 
   1090 Massive Multiauthor Collaboration Site (or MMC Site) means any World
   1091 Wide Web server that publishes copyrightable works and also provides
   1092 prominent facilities for anybody to edit those works.  A public wiki
   1093 that anybody can edit is an example of such a server.  A Massive
   1094 Multiauthor Collaboration (or MMC) contained in the site means any
   1095 set of copyrightable works thus published on the MMC site.
   1096 
   1097 CC-BY-SA means the Creative Commons Attribution-Share Alike 3.0
   1098 license published by Creative Commons Corporation, a not-for-profit
   1099 corporation with a principal place of business in San Francisco,
   1100 California, as well as future copyleft versions of that license
   1101 published by that same organization.
   1102 
   1103 Incorporate means to publish or republish a Document, in whole or in
   1104 part, as part of another Document.
   1105 
   1106 An MMC is eligible for relicensing if it is licensed under this
   1107 License, and if all works that were first published under this License
   1108 somewhere other than this MMC, and subsequently incorporated in whole or
   1109 in part into the MMC, (1) had no cover texts or invariant sections, and
   1110 (2) were thus incorporated prior to November 1, 2008.
   1111 
   1112 The operator of an MMC Site may republish an MMC contained in the site
   1113 under CC-BY-SA on the same site at any time before August 1, 2009,
   1114 provided the MMC is eligible for relicensing.
   1115 
   1116 `ADDENDUM: How to use this License for your documents'
   1117 
   1118 To use this License in a document you have written, include a copy of
   1119 the License in the document and put the following copyright and license
   1120 notices just after the title page:
   1121 
   1122      Copyright  YEAR YOUR NAME. Permission is granted to copy,
   1123      distribute and/or modify this document under the terms of the GNU
   1124      Free Documentation License, Version 1.3 or any later version
   1125      published by the Free Software Foundation; with no Invariant
   1126      Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of
   1127      the license is included in the section entitled GNU Free
   1128      Documentation License.
   1129 
   1130 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
   1131 replace the with  Texts. line with this:
   1132 
   1133      with the Invariant Sections being LIST THEIR TITLES, with the
   1134      Front-Cover Texts being LIST, and with the Back-Cover Texts being
   1135      LIST.
   1136 
   1137 If you have Invariant Sections without Cover Texts, or some other
   1138 combination of the three, merge those two alternatives to suit the
   1139 situation.
   1140 
   1141 If your document contains nontrivial examples of program code, we
   1142 recommend releasing these examples in parallel under your choice of free
   1143 software license, such as the GNU General Public License, to permit
   1144 their use in free software.
   1145 
   1146 
   1147 File: gnat-style.info,  Node: Index,  Prev: Program Structure and Compilation Issues,  Up: Top
   1148 
   1149 Index
   1150 *****
   1151 
   1152 [index]
   1153 * Menu:
   1154 
   1155 * -gnatg option (to gcc):                Program Structure and Compilation Issues.
   1156                                                                (line 10)
   1157 * Alignment (in a block statement):      Block Statements.     (line 10)
   1158 * Alignment (in a loop statement):       Loop Statements.      (line 17)
   1159 * Alignment (in an if statement):        If Statements.        (line 10)
   1160 * Alignment (in comments):               Comments.             (line 51)
   1161 * Alignment (in declarations):           Declarations and Types.
   1162                                                                (line  9)
   1163 * ASCII:                                 Character Set and Separators.
   1164                                                                (line  6)
   1165 * Blank lines (in an if statement):      If Statements.        (line 78)
   1166 * Blank lines (in comments):             Comments.             (line 25)
   1167 * Blank lines (in subprogram bodies):    Subprogram Bodies.    (line 37)
   1168 * Casing (for identifiers):              Identifiers.          (line  9)
   1169 * Casing (for reserved words):           Reserved Words.       (line  8)
   1170 * Casing (in comments):                  Comments.             (line 16)
   1171 * Character set:                         Character Set and Separators.
   1172                                                                (line  6)
   1173 * End-of-line:                           Character Set and Separators.
   1174                                                                (line  6)
   1175 * File name length:                      Program Structure and Compilation Issues.
   1176                                                                (line 15)
   1177 * Hiding of outer entities:              Declarations and Types.
   1178                                                                (line 20)
   1179 * Indentation:                           Character Set and Separators.
   1180                                                                (line  6)
   1181 * Indentation <1>:                       Comments.             (line 25)
   1182 * Indentation (in if statements):        If Statements.        (line 57)
   1183 * krunch.ads file:                       Program Structure and Compilation Issues.
   1184                                                                (line 19)
   1185 * Line length:                           Character Set and Separators.
   1186                                                                (line  6)
   1187 * Name clash avoidance:                  Packages and Visibility Rules.
   1188                                                                (line 21)
   1189 * Operators:                             Expressions and Names.
   1190                                                                (line 12)
   1191 * Parenthesization of expressions:       Expressions and Names.
   1192                                                                (line 17)
   1193 * Separators:                            Character Set and Separators.
   1194                                                                (line  6)
   1195 * Short-circuit forms:                   If Statements.        (line 55)
   1196 * style.adb file:                        Character Set and Separators.
   1197                                                                (line 25)
   1198 * style.adb file <1>:                    Program Structure and Compilation Issues.
   1199                                                                (line 10)
   1200 * Underscores:                           Identifiers.          (line 15)
   1201 * Underscores <1>:                       Numeric Literals.     (line  9)
   1202 * use clauses:                           Packages and Visibility Rules.
   1203                                                                (line 15)
   1204 
   1205 
   1206 
   1207 Tag Table:
   1208 Node: Top366
   1209 Ref: gnat-style doc661
   1210 Ref: 0661
   1211 Node: General877
   1212 Ref: gnat-style general965
   1213 Ref: 1965
   1214 Ref: gnat-style gnat-coding-style-a-guide-for-gnat-developers965
   1215 Ref: 2965
   1216 Node: Lexical Elements1479
   1217 Ref: gnat-style lexical-elements1586
   1218 Ref: 31586
   1219 Node: Character Set and Separators1737
   1220 Ref: gnat-style character-set-and-separators1842
   1221 Ref: 41842
   1222 Node: Identifiers2838
   1223 Ref: gnat-style identifiers2968
   1224 Ref: 52968
   1225 Node: Numeric Literals4041
   1226 Ref: gnat-style numeric-literals4157
   1227 Ref: 64157
   1228 Node: Reserved Words4367
   1229 Ref: gnat-style reserved-words4480
   1230 Ref: 74480
   1231 Node: Comments4698
   1232 Ref: gnat-style comments4786
   1233 Ref: 84786
   1234 Node: Declarations and Types7298
   1235 Ref: gnat-style declarations-and-types7419
   1236 Ref: 97419
   1237 Node: Expressions and Names8898
   1238 Ref: gnat-style expressions-and-names9013
   1239 Ref: a9013
   1240 Node: Statements9541
   1241 Ref: gnat-style statements9645
   1242 Ref: b9645
   1243 Node: Simple and Compound Statements9796
   1244 Ref: gnat-style simple-and-compound-statements9899
   1245 Ref: c9899
   1246 Node: If Statements10149
   1247 Ref: gnat-style if-statements10276
   1248 Ref: d10276
   1249 Node: Case Statements12751
   1250 Ref: gnat-style case-statements12863
   1251 Ref: e12863
   1252 Node: Loop Statements13224
   1253 Ref: gnat-style loop-statements13339
   1254 Ref: f13339
   1255 Node: Block Statements14036
   1256 Ref: gnat-style block-statements14127
   1257 Ref: 1014127
   1258 Node: Subprograms14467
   1259 Ref: gnat-style subprograms14579
   1260 Ref: 1114579
   1261 Node: Subprogram Declarations14668
   1262 Ref: gnat-style subprogram-declarations14769
   1263 Ref: 1214769
   1264 Node: Subprogram Bodies16429
   1265 Ref: gnat-style subprogram-bodies16530
   1266 Ref: 1316530
   1267 Node: Packages and Visibility Rules20266
   1268 Ref: gnat-style packages-and-visibility-rules20408
   1269 Ref: 1420408
   1270 Node: Program Structure and Compilation Issues21431
   1271 Ref: gnat-style program-structure-and-compilation-issues21567
   1272 Ref: 1521567
   1273 Node: GNU Free Documentation License22280
   1274 Ref: share/gnu_free_documentation_license doc22391
   1275 Ref: 1622391
   1276 Ref: share/gnu_free_documentation_license gnu-fdl22391
   1277 Ref: 1722391
   1278 Ref: share/gnu_free_documentation_license gnu-free-documentation-license22391
   1279 Ref: 1822391
   1280 Node: Index45735
   1281 
   1282 End Tag Table
   1283 
   1284 
   1285 Local Variables:
   1286 coding: utf-8
   1287 End:
   1288