Mercurial > hg > CbC > CbC_gcc
comparison gcc/ada/doc/gnat_ugn/gnat_utility_programs.rst @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
17 * :ref:`The_Cross-Referencing_Tools_gnatxref_and_gnatfind` | 17 * :ref:`The_Cross-Referencing_Tools_gnatxref_and_gnatfind` |
18 * :ref:`The_Ada_to_HTML_Converter_gnathtml` | 18 * :ref:`The_Ada_to_HTML_Converter_gnathtml` |
19 * :ref:`The_Ada-to-XML_Converter_gnat2xml` | 19 * :ref:`The_Ada-to-XML_Converter_gnat2xml` |
20 * :ref:`The_Coding_Standard_Verifier_gnatcheck` | 20 * :ref:`The_Coding_Standard_Verifier_gnatcheck` |
21 * :ref:`The_GNAT_Metrics_Tool_gnatmetric` | 21 * :ref:`The_GNAT_Metrics_Tool_gnatmetric` |
22 * :ref:`The_GNAT_Pretty-Printer_gnatpp` | 22 * :ref:`The_GNAT_Pretty_Printer_gnatpp` |
23 * :ref:`The_Body_Stub_Generator_gnatstub` | 23 * :ref:`The_Body_Stub_Generator_gnatstub` |
24 * :ref:`The_Unit_Test_Generator_gnattest` | 24 * :ref:`The_Unit_Test_Generator_gnattest` |
25 * :ref:`The_Backtrace_Symbolizer_gnatsymbolize` | |
25 | 26 |
26 It also describes how several of these tools can be used in conjunction | 27 It also describes how several of these tools can be used in conjunction |
27 with project files: :ref:`Using_Project_Files_with_GNAT_Tools` | 28 with project files: :ref:`Using_Project_Files_with_GNAT_Tools` |
28 | 29 |
29 .. only:: FSF | 30 .. only:: FSF |
585 .. index:: --ext (gnatxref) | 586 .. index:: --ext (gnatxref) |
586 | 587 |
587 :switch:`--ext={extension}` | 588 :switch:`--ext={extension}` |
588 Specify an alternate ali file extension. The default is ``ali`` and other | 589 Specify an alternate ali file extension. The default is ``ali`` and other |
589 extensions (e.g. ``gli`` for C/C++ sources) may be specified via this switch. | 590 extensions (e.g. ``gli`` for C/C++ sources) may be specified via this switch. |
590 Note that if this switch overrides the default, which means that only the | 591 Note that if this switch overrides the default, only the new extension will |
591 new extension will be considered. | 592 be considered. |
592 | 593 |
593 | 594 |
594 .. index:: --RTS (gnatxref) | 595 .. index:: --RTS (gnatxref) |
595 | 596 |
596 :switch:`--RTS={rts-path}` | 597 :switch:`--RTS={rts-path}` |
773 | 774 |
774 .. index:: --ext (gnatfind) | 775 .. index:: --ext (gnatfind) |
775 | 776 |
776 :switch:`--ext={extension}` | 777 :switch:`--ext={extension}` |
777 Specify an alternate ali file extension. The default is ``ali`` and other | 778 Specify an alternate ali file extension. The default is ``ali`` and other |
778 extensions (e.g. ``gli`` for C/C++ sources when using :switch:`-fdump-xref`) | 779 extensions may be specified via this switch. Note that if this switch |
779 may be specified via this switch. Note that if this switch overrides the | 780 overrides the default, only the new extension will be considered. |
780 default, which means that only the new extension will be considered. | |
781 | 781 |
782 | 782 |
783 .. index:: --RTS (gnatfind) | 783 .. index:: --RTS (gnatfind) |
784 | 784 |
785 :switch:`--RTS={rts-path}` | 785 :switch:`--RTS={rts-path}` |
1398 Take as arguments the files listed in text file ``file``. | 1398 Take as arguments the files listed in text file ``file``. |
1399 Text file ``file`` may contain empty lines that are ignored. | 1399 Text file ``file`` may contain empty lines that are ignored. |
1400 Each nonempty line should contain the name of an existing file. | 1400 Each nonempty line should contain the name of an existing file. |
1401 Several such switches may be specified simultaneously. | 1401 Several such switches may be specified simultaneously. |
1402 | 1402 |
1403 :switch:`--ignore={filename}` | |
1404 Do not process the sources listed in a specified file. This option cannot | |
1405 be used in incremental mode. | |
1406 | |
1403 :switch:`-q` | 1407 :switch:`-q` |
1404 Quiet | 1408 Quiet |
1405 | 1409 |
1406 :switch:`-v` | 1410 :switch:`-v` |
1407 Verbose | 1411 Verbose |
1445 | 1449 |
1446 | 1450 |
1447 ``gnat2xml`` generates XML files that will validate against | 1451 ``gnat2xml`` generates XML files that will validate against |
1448 :file:`ada-schema.xsd`. | 1452 :file:`ada-schema.xsd`. |
1449 | 1453 |
1450 ``xml2gnat`` is a back-translator that translates the XML back | 1454 ``xml2gnat`` is a back-translator that translates the XML back into |
1451 into Ada source code. The Ada generated by ``xml2gnat`` has | 1455 Ada source code. This is primarily for the purpose of testing |
1452 identical semantics to the original Ada code passed to | 1456 ``gnat2xml``, rather than for users. The Ada generated by ``xml2gnat`` |
1453 ``gnat2xml``. It is not textually identical, however --- for | 1457 has identical semantics to the original Ada code passed to |
1454 example, no attempt is made to preserve the original indentation. | 1458 ``gnat2xml``. It is not textually identical, however --- for example, |
1459 no attempt is made to preserve the original indentation. | |
1460 | |
1461 The ``xml2gnat`` command line contains a list of the same Ada files | |
1462 passed to gnat2xml (not the names of xml files). The xml files are | |
1463 assumed to be in an 'xml' subdirectory of the directory in which the | |
1464 Ada source files are. So for example, if the Ada source file is | |
1465 some/dir/mumble.adb, then the xml file is found in | |
1466 some/dir/xml/mumble.adb.xml. You should use the :switch:`--output-dir` | |
1467 switch of ``gnat2xml`` to tell it to generate the output in the xml | |
1468 subdirectory, so ``xml2gnat`` can find it. | |
1469 | |
1470 Output goes into subdirectories "generated_ada" and "self_rep" of the | |
1471 output directory, which is the current directory by default, but can | |
1472 be overridden with --output-dir=dir on the command line. | |
1455 | 1473 |
1456 .. _Structure_of_the_XML: | 1474 .. _Structure_of_the_XML: |
1457 | 1475 |
1458 Structure of the XML | 1476 Structure of the XML |
1459 -------------------- | 1477 -------------------- |
2690 .. index:: -P (gnatmetric) | 2708 .. index:: -P (gnatmetric) |
2691 | 2709 |
2692 :switch:`-P {file}` | 2710 :switch:`-P {file}` |
2693 Indicates the name of the project file that describes the set of sources | 2711 Indicates the name of the project file that describes the set of sources |
2694 to be processed. The exact set of argument sources depends on other options | 2712 to be processed. The exact set of argument sources depends on other options |
2695 specified, see below. | 2713 specified, see below. An aggregate project is allowed as the file parameter |
2714 only if it has exactly one non-aggregate project being aggregated. | |
2696 | 2715 |
2697 | 2716 |
2698 .. index:: -U (gnatmetric) | 2717 .. index:: -U (gnatmetric) |
2699 | 2718 |
2700 :switch:`-U` | 2719 :switch:`-U` |
2751 Text file ``file`` may contain empty lines that are ignored. | 2770 Text file ``file`` may contain empty lines that are ignored. |
2752 Each nonempty line should contain the name of an existing file. | 2771 Each nonempty line should contain the name of an existing file. |
2753 Several such switches may be specified simultaneously. | 2772 Several such switches may be specified simultaneously. |
2754 | 2773 |
2755 | 2774 |
2775 .. index:: --ignore (gnatmetric) | |
2776 | |
2777 :switch:`--ignore={filename}` | |
2778 Do not process the sources listed in a specified file. | |
2779 | |
2756 .. index:: -j (gnatmetric) | 2780 .. index:: -j (gnatmetric) |
2757 | 2781 |
2758 :switch:`-j{n}` | 2782 :switch:`-j{n}` |
2759 Use ``n`` processes to carry out the tree creations (internal representations | 2783 Use ``n`` processes to carry out the tree creations (internal representations |
2760 of the argument sources). On a multiprocessor machine this speeds up processing | 2784 of the argument sources). On a multiprocessor machine this speeds up processing |
2787 all the immediate units of the argument project. | 2811 all the immediate units of the argument project. |
2788 | 2812 |
2789 | 2813 |
2790 .. only:: PRO or GPL | 2814 .. only:: PRO or GPL |
2791 | 2815 |
2792 .. _The_GNAT_Pretty-Printer_gnatpp: | 2816 .. _The_GNAT_Pretty_Printer_gnatpp: |
2793 | 2817 |
2794 The GNAT Pretty-Printer ``gnatpp`` | 2818 The GNAT Pretty Printer ``gnatpp`` |
2795 ================================== | 2819 ================================== |
2796 | 2820 |
2797 .. index:: ! gnatpp | 2821 .. index:: ! gnatpp |
2798 .. index:: Pretty-Printer | 2822 .. index:: pretty printer |
2799 | 2823 |
2800 The ``gnatpp`` tool is an ASIS-based utility | 2824 This documentation is for the new libadalang-based version |
2801 for source reformatting / pretty-printing. | 2825 of ``gnatpp``, which replaces the ASIS-based version. |
2802 It takes an Ada source file as input and generates a reformatted | 2826 |
2803 version as output. | 2827 The ``gnatpp`` tool is a utility for source reformatting / pretty |
2804 You can specify various style directives via switches; e.g., | 2828 printing. It takes an Ada source file as input and generates a |
2805 identifier case conventions, rules of indentation, and comment layout. | 2829 reformatted version as output. You can specify various style |
2830 directives via switches; e.g., identifier case conventions, rules of | |
2831 indentation, and comment layout. | |
2806 | 2832 |
2807 ``gnatpp`` is a project-aware tool | 2833 ``gnatpp`` is a project-aware tool |
2808 (see :ref:`Using_Project_Files_with_GNAT_Tools` for a description of | 2834 (see :ref:`Using_Project_Files_with_GNAT_Tools` for a description of |
2809 the project-related switches). The project file package that can specify | 2835 the project-related switches). The project file package that can specify |
2810 ``gnatpp`` switches is named ``Pretty_Printer``. | 2836 ``gnatpp`` switches is named ``Pretty_Printer``. |
2811 | 2837 |
2812 To produce a reformatted file, ``gnatpp`` invokes the Ada | 2838 ``gnatpp`` cannot process sources that contain preprocessing |
2813 compiler and generates and uses the ASIS tree for the input source; | 2839 directives. |
2814 thus the input must be legal Ada code, and the tool should have all the | |
2815 information needed to compile the input source. To provide this information, | |
2816 you may specify as a tool parameter the project file the input source belongs to. | |
2817 Another possibility is to specify the source search | |
2818 path and needed configuration files in ``-cargs`` section of ``gnatpp`` | |
2819 call, see the description of the ``gnatpp`` switches below. | |
2820 | |
2821 ``gnatpp`` cannot process sources that contain preprocessing directives. | |
2822 | 2840 |
2823 The ``gnatpp`` command has the form | 2841 The ``gnatpp`` command has the form |
2824 | 2842 |
2825 :: | 2843 :: |
2826 | 2844 |
2827 $ gnatpp [ switches ] filename [ -cargs gcc_switches ] | 2845 $ gnatpp [ switches ] filename |
2828 | 2846 |
2829 where | 2847 where |
2830 | 2848 |
2831 * ``switches`` is an optional sequence of switches defining such properties as | 2849 * ``switches`` is an optional sequence of switches defining such properties as |
2832 the formatting rules, the source search path, and the destination for the | 2850 the formatting rules, the source search path, and the destination for the |
2833 output source file | 2851 output source file |
2834 | 2852 |
2835 * ``filename`` is the name (including the extension) of the source file to | 2853 * ``filename`` is the name of the source file to reformat; wildcards |
2836 reformat; wildcards or several file names on the same gnatpp command are | 2854 or several file names on the same gnatpp command are allowed. The |
2837 allowed. The file name may contain path information; it does not have to | 2855 file name may contain path information; it does not have to follow |
2838 follow the GNAT file naming rules | 2856 the GNAT file naming rules |
2839 | |
2840 * ``gcc_switches`` is a list of switches for | |
2841 ``gcc``. They will be passed on to all compiler invocations made by | |
2842 ``gnatpp`` to generate the ASIS trees. Here you can provide | |
2843 ``-I`` switches to form the source search path, | |
2844 use the ``-gnatec`` switch to set the configuration file, etc. | |
2845 | 2857 |
2846 | 2858 |
2847 .. _Switches_for_gnatpp: | 2859 .. _Switches_for_gnatpp: |
2848 | 2860 |
2849 Switches for ``gnatpp`` | 2861 Switches for ``gnatpp`` |
2880 * ``:=`` in initializations in declarations, | 2892 * ``:=`` in initializations in declarations, |
2881 * ``:=`` in assignment statements, | 2893 * ``:=`` in assignment statements, |
2882 * ``=>`` in associations, and | 2894 * ``=>`` in associations, and |
2883 * ``at`` keywords in the component clauses in record representation clauses. | 2895 * ``at`` keywords in the component clauses in record representation clauses. |
2884 | 2896 |
2885 | 2897 In addition, ``in`` and ``out`` in parameter specifications are lined up. |
2886 .. index:: -A0 (gnatpp) | 2898 |
2887 .. index:: -A1 (gnatpp) | 2899 .. index:: --no-alignment (gnatpp) |
2888 | 2900 .. index:: --alignment (gnatpp) |
2889 | 2901 .. index:: --no-align-modes (gnatpp) |
2890 :switch:`-A0` | 2902 |
2903 | |
2904 :switch:`--no-alignment` | |
2891 Set alignment to OFF | 2905 Set alignment to OFF |
2892 | 2906 |
2893 | 2907 |
2894 :switch:`-A1` | 2908 :switch:`--alignment` |
2895 Set alignment to ON | 2909 Set alignment to ON |
2910 | |
2911 | |
2912 :switch:`--no-align-modes` | |
2913 Do not line up ``in`` and ``out`` in parameter specifications. | |
2896 | 2914 |
2897 .. _Casing_Control: | 2915 .. _Casing_Control: |
2898 | 2916 |
2899 | 2917 |
2900 Casing Control | 2918 Casing Control |
2911 Three types of casing are supported: lower case, upper case, and mixed case. | 2929 Three types of casing are supported: lower case, upper case, and mixed case. |
2912 'Mixed case' means that the first letter, and also each letter immediately | 2930 'Mixed case' means that the first letter, and also each letter immediately |
2913 following an underscore, are converted to their uppercase forms; | 2931 following an underscore, are converted to their uppercase forms; |
2914 all the other letters are converted to their lowercase forms. | 2932 all the other letters are converted to their lowercase forms. |
2915 | 2933 |
2916 .. index:: -a (gnatpp) | 2934 (Note: the casing switches are not yet fully supported in the |
2917 | 2935 libadalang-based version of gnatpp.) |
2918 | 2936 |
2919 :switch:`-aL` | 2937 .. index:: --name-case-as-declared (gnatpp) |
2938 | |
2939 :switch:`--name-case-as-declared` | |
2940 Name casing for defining occurrences are as they appear in the source file | |
2941 (this is the default) | |
2942 | |
2943 .. index:: --name-upper-case (gnatpp) | |
2944 | |
2945 :switch:`--name-upper-case` | |
2946 Names are in upper case | |
2947 | |
2948 .. index:: --name-lower-case (gnatpp) | |
2949 | |
2950 :switch:`--name-lower-case` | |
2951 Names are in lower case | |
2952 | |
2953 .. index:: --name-mixed-case (gnatpp) | |
2954 | |
2955 :switch:`--name-mixed-case` | |
2956 Names are in mixed case | |
2957 | |
2958 .. index:: --attribute-lower-case (gnatpp) | |
2959 | |
2960 :switch:`--attribute-lower-case` | |
2920 Attribute designators are lower case | 2961 Attribute designators are lower case |
2921 | 2962 |
2922 | 2963 .. index:: --attribute-upper-case (gnatpp) |
2923 :switch:`-aU` | 2964 |
2965 :switch:`--attribute-upper-case` | |
2924 Attribute designators are upper case | 2966 Attribute designators are upper case |
2925 | 2967 |
2926 | 2968 .. index:: --attribute-mixed-case (gnatpp) |
2927 :switch:`-aM` | 2969 |
2970 :switch:`--attribute-mixed-case` | |
2928 Attribute designators are mixed case (this is the default) | 2971 Attribute designators are mixed case (this is the default) |
2929 | 2972 |
2930 .. index:: -k (gnatpp) | 2973 .. index:: --keyword-lower-case (gnatpp) |
2931 | 2974 |
2932 | 2975 :switch:`--keyword-lower-case` |
2933 :switch:`-kL` | |
2934 Keywords (technically, these are known in Ada as *reserved words*) are | 2976 Keywords (technically, these are known in Ada as *reserved words*) are |
2935 lower case (this is the default) | 2977 lower case (this is the default) |
2936 | 2978 |
2937 | 2979 .. index:: --keyword-upper-case (gnatpp) |
2938 :switch:`-kU` | 2980 |
2981 :switch:`--keyword-upper-case` | |
2939 Keywords are upper case | 2982 Keywords are upper case |
2940 | 2983 |
2941 .. index:: -n (gnatpp) | 2984 .. index:: --enum-case-as-declared (gnatpp) |
2942 | 2985 |
2943 | 2986 :switch:`--enum-case-as-declared` |
2944 :switch:`-nD` | |
2945 Name casing for defining occurrences are as they appear in the source file | |
2946 (this is the default) | |
2947 | |
2948 | |
2949 :switch:`-nU` | |
2950 Names are in upper case | |
2951 | |
2952 | |
2953 :switch:`-nL` | |
2954 Names are in lower case | |
2955 | |
2956 | |
2957 :switch:`-nM` | |
2958 Names are in mixed case | |
2959 | |
2960 .. index:: -ne (gnatpp) | |
2961 | |
2962 | |
2963 :switch:`-neD` | |
2964 Enumeration literal casing for defining occurrences are as they appear in the | 2987 Enumeration literal casing for defining occurrences are as they appear in the |
2965 source file. Overrides -n casing setting. | 2988 source file. Overrides -n casing setting. |
2966 | 2989 |
2967 | 2990 .. index:: --enum-upper-case (gnatpp) |
2968 :switch:`-neU` | 2991 |
2992 :switch:`--enum-upper-case` | |
2969 Enumeration literals are in upper case. Overrides -n casing | 2993 Enumeration literals are in upper case. Overrides -n casing |
2970 setting. | 2994 setting. |
2971 | 2995 |
2972 | 2996 .. index:: --enum-lower-case (gnatpp) |
2973 :switch:`-neL` | 2997 |
2998 :switch:`--enum-lower-case` | |
2974 Enumeration literals are in lower case. Overrides -n casing | 2999 Enumeration literals are in lower case. Overrides -n casing |
2975 setting. | 3000 setting. |
2976 | 3001 |
2977 | 3002 .. index:: --enum-mixed-case (gnatpp) |
2978 :switch:`-neM` | 3003 |
3004 :switch:`--enum-mixed-case` | |
2979 Enumeration literals are in mixed case. Overrides -n casing | 3005 Enumeration literals are in mixed case. Overrides -n casing |
2980 setting. | 3006 setting. |
2981 | 3007 |
2982 .. index:: -nt (gnatpp) | 3008 .. index:: --type-case-as-declared (gnatpp) |
2983 | 3009 |
2984 | 3010 :switch:`--type-case-as-declared` |
2985 :switch:`-ntD` | |
2986 Names introduced by type and subtype declarations are always | 3011 Names introduced by type and subtype declarations are always |
2987 cased as they appear in the declaration in the source file. | 3012 cased as they appear in the declaration in the source file. |
2988 Overrides -n casing setting. | 3013 Overrides -n casing setting. |
2989 | 3014 |
2990 | 3015 .. index:: --type-upper-case (gnatpp) |
2991 :switch:`-ntU` | 3016 |
3017 :switch:`--type-upper-case` | |
2992 Names introduced by type and subtype declarations are always in | 3018 Names introduced by type and subtype declarations are always in |
2993 upper case. Overrides -n casing setting. | 3019 upper case. Overrides -n casing setting. |
2994 | 3020 |
2995 | 3021 .. index:: --type-lower-case (gnatpp) |
2996 :switch:`-ntL` | 3022 |
3023 :switch:`--type-lower-case` | |
2997 Names introduced by type and subtype declarations are always in | 3024 Names introduced by type and subtype declarations are always in |
2998 lower case. Overrides -n casing setting. | 3025 lower case. Overrides -n casing setting. |
2999 | 3026 |
3000 | 3027 .. index:: --type-mixed-case (gnatpp) |
3001 :switch:`-ntM` | 3028 |
3029 :switch:`--type-mixed-case` | |
3002 Names introduced by type and subtype declarations are always in | 3030 Names introduced by type and subtype declarations are always in |
3003 mixed case. Overrides -n casing setting. | 3031 mixed case. Overrides -n casing setting. |
3004 | 3032 |
3005 | 3033 .. index:: --number-upper-case (gnatpp) |
3006 :switch:`-nnU` | 3034 |
3035 :switch:`--number-upper-case` | |
3007 Names introduced by number declarations are always in | 3036 Names introduced by number declarations are always in |
3008 upper case. Overrides -n casing setting. | 3037 upper case. Overrides -n casing setting. |
3009 | 3038 |
3010 | 3039 .. index:: --number-lower-case (gnatpp) |
3011 :switch:`-nnL` | 3040 |
3041 :switch:`--number-lower-case` | |
3012 Names introduced by number declarations are always in | 3042 Names introduced by number declarations are always in |
3013 lower case. Overrides -n casing setting. | 3043 lower case. Overrides -n casing setting. |
3014 | 3044 |
3015 | 3045 .. index:: --number-mixed-case (gnatpp) |
3016 :switch:`-nnM` | 3046 |
3047 :switch:`--number-mixed-case` | |
3017 Names introduced by number declarations are always in | 3048 Names introduced by number declarations are always in |
3018 mixed case. Overrides -n casing setting. | 3049 mixed case. Overrides -n casing setting. |
3019 | 3050 |
3020 .. index:: -p (gnatpp) | 3051 .. index:: --pragma-lower-case (gnatpp) |
3021 | 3052 |
3022 | 3053 :switch:`--pragma-lower-case` |
3023 :switch:`-pL` | |
3024 Pragma names are lower case | 3054 Pragma names are lower case |
3025 | 3055 |
3026 | 3056 .. index:: --pragma-upper-case (gnatpp) |
3027 :switch:`-pU` | 3057 |
3058 :switch:`--pragma-upper-case` | |
3028 Pragma names are upper case | 3059 Pragma names are upper case |
3029 | 3060 |
3030 | 3061 .. index:: --pragma-mixed-case (gnatpp) |
3031 :switch:`-pM` | 3062 |
3063 :switch:`--pragma-mixed-case` | |
3032 Pragma names are mixed case (this is the default) | 3064 Pragma names are mixed case (this is the default) |
3033 | 3065 |
3034 | 3066 |
3035 .. index:: -D (gnatpp) | 3067 .. index:: --syntax-only (gnatpp) |
3036 | 3068 |
3037 :switch:`-D{file}` | 3069 :switch:`--syntax-only` |
3070 Disable the semantic analysis (name resolution) done by libadalang. | |
3071 This means gnatpp will not be able to support any of the | |
3072 "as-declared" switches. | |
3073 | |
3074 | |
3075 .. index:: --dictionary (gnatpp) | |
3076 | |
3077 :switch:`--dictionary={file}` | |
3038 Use ``file`` as a *dictionary file* that defines | 3078 Use ``file`` as a *dictionary file* that defines |
3039 the casing for a set of specified names, | 3079 the casing for a set of specified names, |
3040 thereby overriding the effect on these names by | 3080 thereby overriding the effect on these names by |
3041 any explicit or implicit | 3081 any explicit or implicit |
3042 -n switch. | 3082 -n switch. |
3043 To supply more than one dictionary file, | 3083 To supply more than one dictionary file, |
3044 use several ``-D`` switches. | 3084 use several ``--dictionary`` switches. |
3045 | 3085 |
3046 ``gnatpp`` implicitly uses a *default dictionary file* | 3086 ``gnatpp`` implicitly uses a *default dictionary file* |
3047 to define the casing for the Ada predefined names and | 3087 to define the casing for the Ada predefined names and |
3048 the names declared in the GNAT libraries. | 3088 the names declared in the GNAT libraries. |
3049 | 3089 |
3050 | 3090 |
3051 .. index:: -D- (gnatpp) | 3091 .. index:: --dictionary=- (gnatpp) |
3052 | 3092 |
3053 :switch:`-D-` | 3093 :switch:`--dictionary=-` |
3054 Do not use the default dictionary file; | 3094 Do not use the default dictionary file; |
3055 instead, use the casing | 3095 instead, use the casing |
3056 defined by a ``-n`` switch and any explicit | 3096 defined by a ``-n`` switch and any explicit |
3057 dictionary file(s) | 3097 dictionary file(s) |
3058 | 3098 |
3059 The structure of a dictionary file, and details on the conventions | 3099 The structure of a dictionary file, and details on the conventions |
3060 used in the default dictionary file, are defined in :ref:`Name_Casing`. | 3100 used in the default dictionary file, are defined in :ref:`Name_Casing`. |
3061 | 3101 |
3062 The :switch:`-D-` and | 3102 The :switch:`--dictionary=-` and |
3063 :switch:`-D{file}` switches are mutually | 3103 :switch:`--dictionary={file}` switches are mutually |
3064 compatible. | 3104 compatible. |
3065 | 3105 |
3066 This group of ``gnatpp`` switches controls the layout of comments and | 3106 This group of ``gnatpp`` switches controls the layout of comments and |
3067 complex syntactic constructs. See :ref:`Formatting_Comments` for details | 3107 complex syntactic constructs. See :ref:`Formatting_Comments` for details |
3068 on their effect. | 3108 on their effect. |
3069 | 3109 |
3070 | 3110 |
3071 .. index:: -c (gnatpp) | 3111 .. index:: -c (gnatpp) |
3072 | 3112 |
3073 | 3113 |
3074 :switch:`-c0` | 3114 :switch:`--comments-unchanged` |
3075 All comments remain unchanged. | 3115 All comments remain unchanged. |
3076 | 3116 |
3077 | 3117 |
3078 :switch:`-c1` | 3118 :switch:`--comments-gnat-indentation` |
3079 GNAT-style comment line indentation. | 3119 GNAT-style comment line indentation. |
3080 This is the default. | 3120 This is the default. |
3081 | 3121 |
3082 | 3122 |
3083 :switch:`-c3` | 3123 :switch:`--comments-gnat-beginning` |
3084 GNAT-style comment beginning. | 3124 GNAT-style comment beginning. |
3085 | 3125 |
3086 | 3126 |
3087 :switch:`-c4` | 3127 :switch:`--comments-fill` |
3088 Fill comment blocks. | 3128 Fill comment blocks. |
3089 | 3129 |
3090 | 3130 |
3091 :switch:`-c5` | 3131 :switch:`--comments-special` |
3092 Keep unchanged special form comments. | 3132 Keep unchanged special form comments. |
3093 This is the default. | 3133 This is the default. |
3094 | 3134 |
3095 | 3135 |
3096 .. index:: --comments-only (gnatpp) | 3136 .. index:: --comments-only (gnatpp) |
3131 | 3171 |
3132 | 3172 |
3133 :switch:`--use-on-new-line` | 3173 :switch:`--use-on-new-line` |
3134 Start each USE clause in a context clause from a separate line. | 3174 Start each USE clause in a context clause from a separate line. |
3135 | 3175 |
3176 | |
3136 .. index:: --insert-blank-lines (gnatpp) | 3177 .. index:: --insert-blank-lines (gnatpp) |
3137 | 3178 |
3138 | 3179 |
3139 :switch:`--insert-blank-lines` | 3180 :switch:`--insert-blank-lines` |
3140 Insert blank lines where appropriate (between bodies and other large | 3181 Insert blank lines where appropriate (between bodies and other large |
3145 | 3186 |
3146 :switch:`--preserve-blank-lines` | 3187 :switch:`--preserve-blank-lines` |
3147 Preserve blank lines in the input. By default, gnatpp will squeeze | 3188 Preserve blank lines in the input. By default, gnatpp will squeeze |
3148 multiple blank lines down to one. | 3189 multiple blank lines down to one. |
3149 | 3190 |
3150 | 3191 .. index:: --preserve-line-breaks (gnatpp) |
3151 The ``-c`` switches are compatible with one another, except that | 3192 |
3152 the ``-c0`` switch disables all other comment formatting | 3193 :switch:`--preserve-line-breaks` |
3153 switches. | 3194 Preserve line breaks in the input, to the extent possible. |
3195 | |
3196 The ``--comments`` switches are compatible with one another, except | |
3197 that the ``--comments-unchanged`` switch disables all other comment | |
3198 formatting switches. | |
3154 | 3199 |
3155 | 3200 |
3156 .. _General_Text_Layout_Control: | 3201 .. _General_Text_Layout_Control: |
3157 | 3202 |
3158 General Text Layout Control | 3203 General Text Layout Control |
3159 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 3204 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
3160 | 3205 |
3161 These switches allow control over line length and indentation. | 3206 These switches allow control over line length and indentation. |
3162 | 3207 |
3163 .. index:: -M (gnatpp) | 3208 .. index:: --max-line-length (gnatpp) |
3164 | 3209 |
3165 :switch:`-M{nnn}` | 3210 :switch:`--max-line-length={nnn}` |
3166 Maximum line length, ``nnn`` from 32...256, the default value is 79 | 3211 Maximum line length, ``nnn`` from 32...256, the default value is 79 |
3167 | 3212 |
3168 | 3213 |
3169 .. index:: -i (gnatpp) | 3214 .. index:: --indentation (gnatpp) |
3170 | 3215 |
3171 :switch:`-i{nnn}` | 3216 :switch:`--indentation={nnn}` |
3172 Indentation level, ``nnn`` from 1...9, the default value is 3 | 3217 Indentation level, ``nnn`` from 1...9, the default value is 3 |
3173 | 3218 |
3174 | 3219 |
3175 .. index:: -cl (gnatpp) | 3220 .. index:: --indent-continuation (gnatpp) |
3176 | 3221 |
3177 :switch:`-cl{nnn}` | 3222 :switch:`--indent-continuation={nnn}` |
3178 Indentation level for continuation lines (relative to the line being | 3223 Indentation level for continuation lines (relative to the line being |
3179 continued), ``nnn`` from 1...9. | 3224 continued), ``nnn`` from 1...9. |
3180 The default | 3225 The default |
3181 value is one less than the (normal) indentation level, unless the | 3226 value is one less than the (normal) indentation level, unless the |
3182 indentation is set to 1 (in which case the default value for continuation | 3227 indentation is set to 1 (in which case the default value for continuation |
3206 Same as ``--decimal-grouping``, but for based literals. For | 3251 Same as ``--decimal-grouping``, but for based literals. For |
3207 example, with ``--based-grouping=4``, ``16#0001FFFE#`` will be | 3252 example, with ``--based-grouping=4``, ``16#0001FFFE#`` will be |
3208 changed to ``16#0001_FFFE#``. | 3253 changed to ``16#0001_FFFE#``. |
3209 | 3254 |
3210 | 3255 |
3256 .. index:: --split-line-before-record (gnatpp) | |
3257 | |
3258 :switch:`--split-line-before-record` | |
3259 Split the line just before ``record`` in a record type declaration. | |
3260 | |
3261 | |
3262 .. index:: --indent-named-statements (gnatpp) | |
3263 | |
3264 :switch:`--indent-named-statements` | |
3265 Named block and loop statements are indented with respect to | |
3266 the name. | |
3267 | |
3268 | |
3211 .. index:: --split-line-before-op (gnatpp) | 3269 .. index:: --split-line-before-op (gnatpp) |
3212 | 3270 |
3213 :switch:`--split-line-before-op` | 3271 :switch:`--split-line-before-op` |
3214 If it is necessary to split a line at a binary operator, by default | 3272 If it is necessary to split a line at a binary operator, by default |
3215 the line is split after the operator. With this option, it is split | 3273 the line is split after the operator. With this option, it is split |
3221 :switch:`--RM-style-spacing` | 3279 :switch:`--RM-style-spacing` |
3222 Do not insert an extra blank before various occurrences of | 3280 Do not insert an extra blank before various occurrences of |
3223 '(' and ':'. This also turns off alignment. | 3281 '(' and ':'. This also turns off alignment. |
3224 | 3282 |
3225 | 3283 |
3226 .. index:: -ff (gnatpp) | 3284 .. index:: --ff-after-pragma-page (gnatpp) |
3227 | 3285 |
3228 :switch:`-ff` | 3286 :switch:`--ff-after-pragma-page` |
3229 Insert a Form Feed character after a pragma Page. | 3287 Insert a Form Feed character after a pragma Page. |
3230 | 3288 |
3231 | 3289 |
3232 .. index:: --call_threshold (gnatpp) | 3290 .. index:: --call_threshold (gnatpp) |
3233 | 3291 |
3244 If the number of parameter specifications is greater than ``nnn`` | 3302 If the number of parameter specifications is greater than ``nnn`` |
3245 (or equal to ``nnn`` in case of a function), start each specification from | 3303 (or equal to ``nnn`` in case of a function), start each specification from |
3246 a new line. If ``nnn`` is 0, and :switch:`--no-separate-is` was not specified, then | 3304 a new line. If ``nnn`` is 0, and :switch:`--no-separate-is` was not specified, then |
3247 the ``is`` is placed on a separate line. This feature is disabled by default. | 3305 the ``is`` is placed on a separate line. This feature is disabled by default. |
3248 | 3306 |
3307 .. index:: --vertical-enum-types (gnatpp) | |
3308 | |
3309 :switch:`--vertical-enum-types` | |
3310 Format enumeration type declarations "vertically", e.g. each | |
3311 enumeration literal goes on a separate line. | |
3312 | |
3313 .. index:: --vertical-array-types (gnatpp) | |
3314 | |
3315 :switch:`--vertical-array-types` | |
3316 Format array type declarations "vertically", e.g. for | |
3317 multidimensional arrays, each index_subtype_definition or | |
3318 discrete_subtype_definition goes on a separate line. | |
3319 | |
3320 .. index:: --vertical-named-aggregates (gnatpp) | |
3321 | |
3322 :switch:`--vertical-named-aggregates` | |
3323 Format aggregates "vertically" if named notation is used for all | |
3324 component_associations, e.g. each component_association | |
3325 goes on a separate line. | |
3326 | |
3327 .. index:: --vertical-case-alternatives (gnatpp) | |
3328 | |
3329 :switch:`--vertical-case-alternatives` | |
3330 Format case statements, case expressions, and variant parts with | |
3331 additional line breaks. | |
3332 | |
3249 | 3333 |
3250 .. _Setting_the_Source_Search_Path: | 3334 .. _Setting_the_Source_Search_Path: |
3251 | 3335 |
3252 Setting the Source Search Path | 3336 Setting the Source Search Path |
3253 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 3337 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
3272 .. _Output_File_Control-gnatpp: | 3356 .. _Output_File_Control-gnatpp: |
3273 | 3357 |
3274 Output File Control | 3358 Output File Control |
3275 ^^^^^^^^^^^^^^^^^^^ | 3359 ^^^^^^^^^^^^^^^^^^^ |
3276 | 3360 |
3277 By default the output is sent to a file whose name is obtained by appending | 3361 By default the output overwrites the input file. |
3278 the :file:`.pp` suffix to the name of the input file. | |
3279 If the file with this name already exists, it is overwritten. | |
3280 Thus if the input file is :file:`my_ada_proc.adb` then | |
3281 ``gnatpp`` will produce :file:`my_ada_proc.adb.pp` | |
3282 as output file. | |
3283 The output may be redirected by the following switches: | 3362 The output may be redirected by the following switches: |
3284 | 3363 |
3285 | 3364 |
3365 .. index:: --replace (gnatpp) | |
3366 | |
3367 :switch:`--replace` | |
3368 This is the default. | |
3369 Replace the input source file with the reformatted output without | |
3370 creating any backup copy of the input source. | |
3371 | |
3372 | |
3286 .. index:: --output-dir (gnatpp) | 3373 .. index:: --output-dir (gnatpp) |
3287 | 3374 |
3288 :switch:`--output-dir={dir}` | 3375 :switch:`--output-dir={dir}` |
3289 Generate output file in directory :file:`dir` with the same name as the input | 3376 Generate output file in directory :file:`dir` with the same name as |
3290 file. If :file:`dir` is the same as the directory containing the input file, | 3377 the input file. If :file:`dir` is the same as the directory |
3291 the input file is not processed; use ``-rnb`` | 3378 containing the input file, the input file is not processed; use |
3292 if you want to update the input file in place. | 3379 ``--replace`` if you want to update the input file in |
3293 | 3380 place. |
3294 | 3381 |
3295 .. index:: -pipe (gnatpp) | 3382 |
3296 | 3383 .. index:: --pipe (gnatpp) |
3297 :switch:`-pipe` | 3384 |
3385 :switch:`--pipe` | |
3298 Send the output to ``Standard_Output`` | 3386 Send the output to ``Standard_Output`` |
3299 | 3387 |
3300 | 3388 |
3301 .. index:: -o (gnatpp) | 3389 .. index:: --output (gnatpp) |
3302 | 3390 |
3303 :switch:`-o {output_file}` | 3391 :switch:`--output={output_file}` |
3304 Write the output into ``output_file``. | 3392 Write the output into ``output_file``. |
3305 If ``output_file`` already exists, ``gnatpp`` terminates without | 3393 If ``output_file`` already exists, ``gnatpp`` terminates without |
3306 reading or processing the input file. | 3394 reading or processing the input file. |
3307 | 3395 |
3308 | 3396 |
3309 .. index:: -of (gnatpp) | 3397 .. index:: --output-force (gnatpp) |
3310 | 3398 |
3311 :switch:`-of {output_file}` | 3399 :switch:`--output-force={output_file}` |
3312 Write the output into ``output_file``, overwriting the existing file | 3400 Write the output into ``output_file``, overwriting the existing file |
3313 (if one is present). | 3401 (if one is present). |
3314 | 3402 |
3315 | 3403 |
3316 .. index:: -r (gnatpp) | 3404 .. index:: --replace-backup (gnatpp) |
3317 | 3405 |
3318 :switch:`-r` | 3406 :switch:`--replace-backup` |
3319 Replace the input source file with the reformatted output, and copy the | 3407 Replace the input source file with the reformatted output, and copy the |
3320 original input source into the file whose name is obtained by appending the | 3408 original input source into the file whose name is obtained by appending the |
3321 :file:`.npp` suffix to the name of the input file. | 3409 :file:`.npp` suffix to the name of the input file. |
3322 If a file with this name already exists, ``gnatpp`` terminates without | 3410 If a file with this name already exists, ``gnatpp`` terminates without |
3323 reading or processing the input file. | 3411 reading or processing the input file. |
3324 | 3412 |
3325 | 3413 |
3326 .. index:: -rf (gnatpp) | 3414 .. index:: --replace-force-backup (gnatpp) |
3327 | 3415 |
3328 :switch:`-rf` | 3416 :switch:`--replace-force-backup` |
3329 Like ``-r`` except that if the file with the specified name | 3417 Like ``--replace-backup`` except that if the file with the specified name |
3330 already exists, it is overwritten. | 3418 already exists, it is overwritten. |
3331 | 3419 |
3332 | 3420 |
3333 .. index:: -rnb (gnatpp) | |
3334 | |
3335 :switch:`-rnb` | |
3336 Replace the input source file with the reformatted output without | |
3337 creating any backup copy of the input source. | |
3338 | |
3339 | |
3340 .. index:: --eol (gnatpp) | 3421 .. index:: --eol (gnatpp) |
3341 | 3422 |
3342 :switch:`--eol={xxx}` | 3423 :switch:`--eol={xxx}` |
3343 Specifies the line-ending style of the reformatted output file. The ``xxx`` | 3424 Specifies the line-ending style of the reformatted output file. The |
3344 string specified with the switch may be: | 3425 ``xxx`` string specified with the switch may be: |
3345 | 3426 |
3346 * *dos* - MS DOS style, lines end with CR LF characters* | 3427 * *dos* - MS DOS style, lines end with CR LF characters* |
3347 * *crlf* - the same as *dos* | 3428 * *crlf* - the same as *dos* |
3348 * *unix* - UNIX style, lines end with LF character* | 3429 * *unix* - UNIX style, lines end with LF character* |
3349 * *lf* - the same as *unix* | 3430 * *lf* - the same as *unix* |
3350 | 3431 |
3351 .. index:: -W (gnatpp) | 3432 .. index:: --wide-character-encoding (gnatpp) |
3352 | 3433 |
3353 :switch:`-W{e}` | 3434 :switch:`--wide-character-encoding={e}` |
3354 Specify the wide character encoding method for the input and output files. | 3435 Specify the wide character encoding method for the input and output |
3355 ``e`` is one of the following: | 3436 files. ``e`` is one of the following: |
3356 | |
3357 * *h* - Hex encoding | |
3358 | |
3359 * *u* - Upper half encoding | |
3360 | |
3361 * *s* - Shift/JIS encoding | |
3362 | |
3363 * *e* - EUC encoding | |
3364 | 3437 |
3365 * *8* - UTF-8 encoding | 3438 * *8* - UTF-8 encoding |
3366 | 3439 |
3367 * *b* - Brackets encoding (default value) | 3440 * *b* - Brackets encoding (default value) |
3368 | 3441 |
3369 Options ``-o`` and ``-of`` are allowed only if the call to gnatpp | 3442 Options ``--output-file`` and ``--output-force`` are allowed only if |
3370 contains only one file to reformat. | 3443 the call to gnatpp contains only one file to reformat. |
3371 | 3444 |
3372 Option ``--eol`` and ``-W`` cannot be used together | 3445 Option ``--eol`` and ``--wide-character-encoding`` cannot be used together |
3373 with the ``-pipe`` option. | 3446 with the ``--pipe`` option. |
3374 | 3447 |
3375 | 3448 |
3376 .. _Other_gnatpp_Switches: | 3449 .. _Other_gnatpp_Switches: |
3377 | 3450 |
3378 Other ``gnatpp`` Switches | 3451 Other ``gnatpp`` Switches |
3403 | 3476 |
3404 .. index:: -U (gnatpp) | 3477 .. index:: -U (gnatpp) |
3405 | 3478 |
3406 :switch:`-U` | 3479 :switch:`-U` |
3407 If a project file is specified and no argument source is explicitly | 3480 If a project file is specified and no argument source is explicitly |
3408 specified (either directly or by means of ``-files`` option), process | 3481 specified (either directly or by means of ``--files`` option), process |
3409 all the units of the closure of the argument project. Otherwise this option | 3482 all the units of the closure of the argument project. Otherwise this option |
3410 has no effect. | 3483 has no effect. |
3411 | 3484 |
3412 | 3485 |
3413 :switch:`-U {main_unit}` | 3486 :switch:`-U {main_unit}` |
3414 If a project file is specified and no argument source is explicitly | 3487 If a project file is specified and no argument source is explicitly |
3415 specified (either directly or by means of ``-files`` option), process | 3488 specified (either directly or by means of ``--files`` option), process |
3416 the closure of units rooted at ``main_unit``. Otherwise this option | 3489 the closure of units rooted at ``main_unit``. Otherwise this option |
3417 has no effect. | 3490 has no effect. |
3418 | 3491 |
3419 | 3492 |
3420 .. index:: -X (gnatpp) | 3493 .. index:: -X (gnatpp) |
3439 processed if they have been modified, or if files they depend on have | 3512 processed if they have been modified, or if files they depend on have |
3440 been modified. This is similar to the way gnatmake/gprbuild only | 3513 been modified. This is similar to the way gnatmake/gprbuild only |
3441 compiles files that need to be recompiled. A project file is required | 3514 compiles files that need to be recompiled. A project file is required |
3442 in this mode, and the gnat driver (as in *gnat pretty*) is not | 3515 in this mode, and the gnat driver (as in *gnat pretty*) is not |
3443 supported. | 3516 supported. |
3517 (Note: this switch is not yet supported in the libadalang-based | |
3518 version of gnatpp.) | |
3444 | 3519 |
3445 | 3520 |
3446 .. index:: --pp-off (gnatpp) | 3521 .. index:: --pp-off (gnatpp) |
3447 | 3522 |
3448 :switch:`--pp-off={xxx}` | 3523 :switch:`--pp-off={xxx}` |
3455 :switch:`--pp-on={xxx}` | 3530 :switch:`--pp-on={xxx}` |
3456 Use :switch:`--xxx` as the command to turn pretty printing back on, instead | 3531 Use :switch:`--xxx` as the command to turn pretty printing back on, instead |
3457 of the default ``--!pp on``. | 3532 of the default ``--!pp on``. |
3458 | 3533 |
3459 | 3534 |
3460 .. index:: -files (gnatpp) | 3535 .. index:: --files (gnatpp) |
3461 | 3536 |
3462 :switch:`-files {filename}` | 3537 :switch:`--files={filename}` |
3463 Take as arguments the files listed in text file ``file``. | 3538 Take as arguments the files listed in text file ``file``. |
3464 Text file ``file`` may contain empty lines that are ignored. | 3539 Text file ``file`` may contain empty lines that are ignored. |
3465 Each nonempty line should contain the name of an existing file. | 3540 Each nonempty line should contain the name of an existing file. |
3466 Several such switches may be specified simultaneously. | 3541 Several such switches may be specified simultaneously. |
3467 | 3542 |
3468 | 3543 |
3469 .. index:: -j (gnatpp) | 3544 .. index:: --ignore (gnatpp) |
3470 | 3545 |
3471 :switch:`-j{n}` | 3546 :switch:`--ignore={filename}` |
3472 Without ``--incremental``, use *n* processes to carry out the | 3547 Do not process the sources listed in a specified file. This option cannot |
3473 tree creations (internal representations of the argument sources). On | 3548 be used in incremental mode. |
3474 a multiprocessor machine this speeds up processing of big sets of | 3549 |
3475 argument sources. If *n* is 0, then the maximum number of parallel | 3550 .. index:: --jobs (gnatpp) |
3476 tree creations is the number of core processors on the platform. This | 3551 |
3477 option cannot be used together with the :switch:`-r`, | 3552 :switch:`--jobs={n}` |
3478 :switch:`-rf` or | 3553 With ``--incremental``, use *n* ``gnatpp`` processes to perform |
3479 :switch:`-rnb` options. | 3554 pretty printing in parallel. If *n* is 0, then the maximum number |
3480 | 3555 processes is the number of core processors on the platform. |
3481 With ``--incremental``, use *n* ``gnatpp`` processes to | 3556 |
3482 perform pretty-printing in parallel. *n* = 0 means the same as | 3557 |
3483 above. In this case, the :switch:`-r`, | 3558 .. index:: --verbose (gnatpp) |
3484 :switch:`-rf` and | 3559 |
3485 :switch:`-rnb` options are allowed. | 3560 :switch:`--verbose` |
3486 | |
3487 .. index:: -t (gnatpp) | |
3488 | |
3489 | |
3490 :switch:`-t` | |
3491 Print out execution time. | |
3492 | |
3493 | |
3494 .. index:: -v (gnatpp) | |
3495 | |
3496 :switch:`-v` | |
3497 Verbose mode | 3561 Verbose mode |
3498 | 3562 |
3499 | 3563 |
3500 .. index:: -q (gnatpp) | 3564 .. index:: --quiet (gnatpp) |
3501 | 3565 |
3502 :switch:`-q` | 3566 :switch:`--quiet` |
3503 Quiet mode | 3567 Quiet mode |
3504 | 3568 |
3505 If a project file is specified and no argument source is explicitly | 3569 If a project file is specified and no argument source is explicitly |
3506 specified (either directly or by means of ``-files`` option), and no | 3570 specified (either directly or by means of ``--files`` option), and no |
3507 ``-U`` is specified, then the set of processed sources is | 3571 ``-U`` is specified, then the set of processed sources is |
3508 all the immediate units of the argument project. | 3572 all the immediate units of the argument project. |
3573 | |
3574 | |
3575 .. index:: --gnat83 (gnatpp) | |
3576 | |
3577 :switch:`--gnat83` | |
3578 Ada 83 mode | |
3579 | |
3580 | |
3581 .. index:: --gnat95 (gnatpp) | |
3582 | |
3583 :switch:`--gnat95` | |
3584 Ada 95 mode | |
3585 | |
3586 | |
3587 .. index:: --gnat2005 (gnatpp) | |
3588 | |
3589 :switch:`--gnat2005` | |
3590 Ada 2005 mode | |
3591 | |
3592 | |
3593 .. index:: --gnat2012 (gnatpp) | |
3594 | |
3595 :switch:`--gnat2012` | |
3596 Ada 2012 mode | |
3509 | 3597 |
3510 | 3598 |
3511 .. _Formatting_Rules: | 3599 .. _Formatting_Rules: |
3512 | 3600 |
3513 Formatting Rules | 3601 Formatting Rules |
3595 | 3683 |
3596 * an *end-of-line comment*, which follows some other Ada code on | 3684 * an *end-of-line comment*, which follows some other Ada code on |
3597 the same line. | 3685 the same line. |
3598 | 3686 |
3599 A whole-line comment is indented according to the surrounding code, | 3687 A whole-line comment is indented according to the surrounding code, |
3600 with some exceptions. | 3688 with some exceptions. Comments that start in column 1 are kept |
3601 Comments that start in column 1 are kept there. | 3689 there. If possible, comments are not moved so far to the right that |
3602 If possible, comments are not moved so far to the right that the maximum | 3690 the maximum line length is exceeded. The ``--comments-unchanged`` |
3603 line length is exceeded. | 3691 option turns off comment formatting. Special-form comments such as |
3604 The ``-c0`` option | 3692 SPARK-style ``--#...`` are left alone. |
3605 turns off comment formatting. | |
3606 Special-form comments such as SPARK-style ``--#...`` are left alone. | |
3607 | 3693 |
3608 For an end-of-line comment, ``gnatpp`` tries to leave the same | 3694 For an end-of-line comment, ``gnatpp`` tries to leave the same |
3609 number of spaces between the end of the preceding Ada code and the | 3695 number of spaces between the end of the preceding Ada code and the |
3610 beginning of the comment as appear in the original source. | 3696 beginning of the comment as appear in the original source. |
3611 | 3697 |
3612 The ``-c3`` switch | 3698 The ``--comments-gnat-beginning`` switch (GNAT style comment |
3613 (GNAT style comment beginning) has the following | 3699 beginning) has the following effect: |
3614 effect: | |
3615 | 3700 |
3616 * For each whole-line comment that does not end with two hyphens, | 3701 * For each whole-line comment that does not end with two hyphens, |
3617 ``gnatpp`` inserts spaces if necessary after the starting two hyphens | 3702 ``gnatpp`` inserts spaces if necessary after the starting two |
3618 to ensure that there are at least two spaces between these hyphens and the | 3703 hyphens to ensure that there are at least two spaces between |
3619 first non-blank character of the comment. | 3704 these hyphens and the first non-blank character of the comment. |
3620 | 3705 |
3621 The ``-c4`` switch specifies that | 3706 The ``--comments-fill`` switch specifies that whole-line comments |
3622 whole-line comments that form a paragraph will be filled in typical | 3707 that form a paragraph will be filled in typical word processor style |
3623 word processor style (that is, moving words between lines to make the | 3708 (that is, moving words between lines to make the lines other than the |
3624 lines other than the last similar in length ). | 3709 last similar in length ). |
3625 | 3710 |
3626 The ``--comments-only`` switch specifies that only the comments | 3711 The ``--comments-only`` switch specifies that only the comments are |
3627 are formatted; the rest of the program text is left alone. The | 3712 formatted; the rest of the program text is left alone. The comments |
3628 comments are formatted according to the -c3 and -c4 switches; other | 3713 are formatted according to the ``--comments-gnat-beginning`` and |
3629 formatting switches are ignored. For example, | 3714 ``--comments-fill`` switches; other formatting switches are ignored. For |
3630 ``--comments-only -c4`` means to fill comment paragraphs, and do nothing else. | 3715 example, ``--comments-only --comments-fill`` means to fill comment |
3631 Likewise, | 3716 paragraphs, and do nothing else. Likewise, ``--comments-only |
3632 ``--comments-only -c3`` ensures comments start with at least two | 3717 --comments-gnat-beginning`` ensures comments start with at least two |
3633 spaces after ``--``, and ``--comments-only -c3 -c4`` does | 3718 spaces after ``--``, and ``--comments-only --comments-gnat-beginning |
3634 both. If ``--comments-only`` is given without ``-c3`` or | 3719 --comments-fill`` does both. If ``--comments-only`` is given without |
3635 ``-c4``, then gnatpp doesn't format anything. | 3720 ``--comments-gnat-beginning`` or ``--comments-fill``, then gnatpp |
3721 doesn't format anything. | |
3636 | 3722 |
3637 | 3723 |
3638 .. _Name_Casing: | 3724 .. _Name_Casing: |
3639 | 3725 |
3640 Name Casing | 3726 Name Casing |
3641 ^^^^^^^^^^^ | 3727 ^^^^^^^^^^^ |
3642 | 3728 |
3643 ``gnatpp`` always converts the usage occurrence of a (simple) name to | 3729 ``gnatpp`` always converts the usage occurrence of a (simple) name to |
3644 the same casing as the corresponding defining identifier. | 3730 the same casing as the corresponding defining identifier. |
3645 | 3731 |
3646 You control the casing for defining occurrences via the | 3732 You control the casing for defining occurrences via the ``--name...`` |
3647 ``-n`` switch. | 3733 switches. With ``--name-case-as-declared``, which is the default, |
3648 With ``-nD`` ('as declared', which is the default), | 3734 defining occurrences appear exactly as in the source file where they |
3649 defining occurrences appear exactly as in the source file | 3735 are declared. The other values for this switch -- |
3650 where they are declared. | 3736 ``--name-upper-case``, ``--name-lower-case``, ``--name-mixed-case`` |
3651 The other values for this switch -- | 3737 -- result in upper, lower, or mixed case, respectively. If |
3652 ``-nU``, | 3738 ``gnatpp`` changes the casing of a defining occurrence, it |
3653 ``-nL``, | 3739 analogously changes the casing of all the usage occurrences of this |
3654 ``-nM`` -- | 3740 name. |
3655 result in | 3741 |
3656 upper, lower, or mixed case, respectively. | 3742 If the defining occurrence of a name is not in the source compilation |
3657 If ``gnatpp`` changes the casing of a defining | 3743 unit currently being processed by ``gnatpp``, the casing of each |
3658 occurrence, it analogously changes the casing of all the | 3744 reference to this name is changed according to the switch (subject to |
3659 usage occurrences of this name. | 3745 the dictionary file mechanism described below). Thus ``gnatpp`` acts |
3660 | 3746 as though the switch had affected the casing for the defining |
3661 If the defining occurrence of a name is not in the source compilation unit | 3747 occurrence of the name. |
3662 currently being processed by ``gnatpp``, the casing of each reference to | |
3663 this name is changed according to the value of the ``-n`` | |
3664 switch (subject to the dictionary file mechanism described below). | |
3665 Thus ``gnatpp`` acts as though the ``-n`` switch | |
3666 had affected the | |
3667 casing for the defining occurrence of the name. | |
3668 | 3748 |
3669 The options | 3749 The options |
3670 :switch:`-a{x}`, | 3750 :switch:`--attribute...`, |
3671 :switch:`-k{x}`, | 3751 :switch:`--keyword...`, |
3672 :switch:`-ne{x}`, | 3752 :switch:`--enum...`, |
3673 :switch:`-nt{x}`, | 3753 :switch:`--type...`, |
3674 :switch:`-nn{x}`, and | 3754 :switch:`--number...`, and |
3675 :switch:`-p{x}` | 3755 :switch:`--pragma...` |
3676 allow finer-grained control over casing for | 3756 allow finer-grained control over casing for |
3677 attributes, keywords, enumeration literals, | 3757 attributes, keywords, enumeration literals, |
3678 types, named numbers and pragmas, respectively. | 3758 types, named numbers and pragmas, respectively. |
3679 :switch:`-nt{x}` covers subtypes and | 3759 :switch:`--type...` cover subtypes as well. |
3680 task and protected bodies as well. | |
3681 | 3760 |
3682 Some names may need to be spelled with casing conventions that are not | 3761 Some names may need to be spelled with casing conventions that are not |
3683 covered by the upper-, lower-, and mixed-case transformations. | 3762 covered by the upper-, lower-, and mixed-case transformations. |
3684 You can arrange correct casing by placing such names in a | 3763 You can arrange correct casing by placing such names in a |
3685 *dictionary file*, | 3764 *dictionary file*, |
3686 and then supplying a ``-D`` switch. | 3765 and then supplying a ``--dictionary`` switch. |
3687 The casing of names from dictionary files overrides | 3766 The casing of names from dictionary files overrides |
3688 any ``-n`` switch. | 3767 any ``--name...`` switch. |
3689 | 3768 |
3690 To handle the casing of Ada predefined names and the names from GNAT libraries, | 3769 To handle the casing of Ada predefined names and the names from GNAT libraries, |
3691 ``gnatpp`` assumes a default dictionary file. | 3770 ``gnatpp`` assumes a default dictionary file. |
3692 The name of each predefined entity is spelled with the same casing as is used | 3771 The name of each predefined entity is spelled with the same casing as is used |
3693 for the entity in the :title:`Ada Reference Manual` (usually mixed case). | 3772 for the entity in the :title:`Ada Reference Manual` (usually mixed case). |
3694 The name of each entity in the GNAT libraries is spelled with the same casing | 3773 The name of each entity in the GNAT libraries is spelled with the same casing |
3695 as is used in the declaration of that entity. | 3774 as is used in the declaration of that entity. |
3696 | 3775 |
3697 The ``-D-`` switch suppresses the use of | 3776 The ``--dictionary=-`` switch suppresses the use of |
3698 the default dictionary file. Instead, the casing for predefined and | 3777 the default dictionary file. Instead, the casing for predefined and |
3699 GNAT-defined names will be established by the | 3778 GNAT-defined names will be established by the |
3700 ``-n`` switch or explicit dictionary files. For | 3779 ``-n`` switch or explicit dictionary files. For |
3701 example, by default the names ``Ada.Text_IO`` and | 3780 example, by default the names ``Ada.Text_IO`` and |
3702 ``GNAT.OS_Lib`` will appear as just shown, even in the presence of | 3781 ``GNAT.OS_Lib`` will appear as just shown, even in the presence of |
3703 a ``-nU`` switch. To ensure that even | 3782 a ``--name-upper-case`` switch. To ensure that even |
3704 such names are rendered in uppercase, additionally supply the | 3783 such names are rendered in uppercase, additionally supply the |
3705 -D- switch (or else place these names | 3784 --dictionary=- switch (or else place these names |
3706 in upper case in a dictionary file). | 3785 in upper case in a dictionary file). |
3707 | 3786 |
3708 A dictionary file is a plain text file; each line in this file can be | 3787 A dictionary file is a plain text file; each line in this file can be |
3709 either a blank line (containing only space characters), an Ada comment | 3788 either a blank line (containing only space characters), an Ada comment |
3710 line, or the specification of exactly one *casing schema*. | 3789 line, or the specification of exactly one *casing schema*. |
3723 | 3802 |
3724 The casing schema string can be followed by white space and/or an Ada-style | 3803 The casing schema string can be followed by white space and/or an Ada-style |
3725 comment; any amount of white space is allowed before the string. | 3804 comment; any amount of white space is allowed before the string. |
3726 | 3805 |
3727 If a dictionary file is passed as | 3806 If a dictionary file is passed as |
3728 the value of a :switch:`-D{file}` switch | 3807 the value of a :switch:`--dictionary={file}` switch |
3729 then for every | 3808 then for every |
3730 simple name and every identifier, ``gnatpp`` checks if the dictionary | 3809 simple name and every identifier, ``gnatpp`` checks if the dictionary |
3731 defines the casing for the name or for some of its parts (the term 'subword' | 3810 defines the casing for the name or for some of its parts (the term 'subword' |
3732 is used below to denote the part of a name which is delimited by '_' or by | 3811 is used below to denote the part of a name which is delimited by '_' or by |
3733 the beginning or end of the word and which does not contain any '_' inside): | 3812 the beginning or end of the word and which does not contain any '_' inside): |
3779 | 3858 |
3780 If ``gnatpp`` is called with the following switches: | 3859 If ``gnatpp`` is called with the following switches: |
3781 | 3860 |
3782 :: | 3861 :: |
3783 | 3862 |
3784 $ gnatpp -nM -D dict1 -D dict2 test.adb | 3863 $ gnatpp --name-mixed-case --dictionary=dict1 --dictionary=dict2 test.adb |
3785 | 3864 |
3786 then we will get the following name casing in the ``gnatpp`` output: | 3865 then we will get the following name casing in the ``gnatpp`` output: |
3787 | 3866 |
3788 | 3867 |
3789 .. code-block:: ada | 3868 .. code-block:: ada |
3795 Name1_Var : Float; | 3874 Name1_Var : Float; |
3796 begin | 3875 begin |
3797 Name2_NAME3_Name4 := Name4_NAME3_Name2 > NAME1; | 3876 Name2_NAME3_Name4 := Name4_NAME3_Name2 > NAME1; |
3798 end Test; | 3877 end Test; |
3799 | 3878 |
3879 Legacy Switches | |
3880 ^^^^^^^^^^^^^^^ | |
3881 | |
3882 Some switches have a short form, mostly for legacy reasons, | |
3883 as shown below. | |
3884 | |
3885 .. index:: -n (gnatpp) | |
3886 | |
3887 :switch:`-nD` | |
3888 :switch:`--name-case-as-declared` | |
3889 | |
3890 :switch:`-nU` | |
3891 :switch:`--name-upper-case` | |
3892 | |
3893 :switch:`-nL` | |
3894 :switch:`--name-lower-case` | |
3895 | |
3896 :switch:`-nM` | |
3897 :switch:`--name-mixed-case` | |
3898 | |
3899 .. index:: -a (gnatpp) | |
3900 | |
3901 :switch:`-aL` | |
3902 :switch:`--attribute-lower-case` | |
3903 | |
3904 :switch:`-aU` | |
3905 :switch:`--attribute-upper-case` | |
3906 | |
3907 :switch:`-aM` | |
3908 :switch:`--attribute-mixed-case` | |
3909 | |
3910 .. index:: -k (gnatpp) | |
3911 | |
3912 :switch:`-kL` | |
3913 :switch:`--keyword-lower-case` | |
3914 | |
3915 :switch:`-kU` | |
3916 :switch:`--keyword-upper-case` | |
3917 | |
3918 .. index:: -ne (gnatpp) | |
3919 | |
3920 :switch:`-neD` | |
3921 :switch:`--enum-case-as-declared` | |
3922 | |
3923 :switch:`-neU` | |
3924 :switch:`--enum-upper-case` | |
3925 | |
3926 :switch:`-neL` | |
3927 :switch:`--enum-lower-case` | |
3928 | |
3929 :switch:`-neM` | |
3930 :switch:`--enum-mixed-case` | |
3931 | |
3932 .. index:: -nt (gnatpp) | |
3933 | |
3934 :switch:`-ntD` | |
3935 :switch:`--type-case-as-declared` | |
3936 | |
3937 :switch:`-ntU` | |
3938 :switch:`--type-upper-case` | |
3939 | |
3940 :switch:`-ntL` | |
3941 :switch:`--type-lower-case` | |
3942 | |
3943 :switch:`-ntM` | |
3944 :switch:`--type-mixed-case` | |
3945 | |
3946 :switch:`-nnU` | |
3947 :switch:`--number-upper-case` | |
3948 | |
3949 :switch:`-nnL` | |
3950 :switch:`--number-lower-case` | |
3951 | |
3952 :switch:`-nnM` | |
3953 :switch:`--number-mixed-case` | |
3954 | |
3955 .. index:: -p (gnatpp) | |
3956 | |
3957 :switch:`-pL` | |
3958 :switch:`--pragma-lower-case` | |
3959 | |
3960 :switch:`-pU` | |
3961 :switch:`--pragma-upper-case` | |
3962 | |
3963 :switch:`-pM` | |
3964 :switch:`--pragma-mixed-case` | |
3965 | |
3966 .. index:: -D (gnatpp) | |
3967 | |
3968 :switch:`-D{file}` | |
3969 :switch:`--dictionary={file}` | |
3970 | |
3971 .. index:: -D- (gnatpp) | |
3972 | |
3973 :switch:`-D-` | |
3974 :switch:`--dictionary=-` | |
3975 | |
3976 .. index:: -c (gnatpp) | |
3977 | |
3978 :switch:`-c0` | |
3979 :switch:`--comments-unchanged` | |
3980 | |
3981 :switch:`-c1` | |
3982 :switch:`--comments-gnat-indentation` | |
3983 | |
3984 :switch:`-c3` | |
3985 :switch:`--comments-gnat-beginning` | |
3986 | |
3987 :switch:`-c4` | |
3988 :switch:`--comments-fill` | |
3989 | |
3990 :switch:`-c5` | |
3991 :switch:`--comments-special` | |
3992 | |
3993 .. index:: -M (gnatpp) | |
3994 | |
3995 :switch:`-M{nnn}` | |
3996 :switch:`--max-line-length={nnn}` | |
3997 | |
3998 .. index:: -i (gnatpp) | |
3999 | |
4000 :switch:`-i{nnn}` | |
4001 :switch:`--indentation={nnn}` | |
4002 | |
4003 .. index:: -cl (gnatpp) | |
4004 | |
4005 :switch:`-cl{nnn}` | |
4006 :switch:`--indent-continuation={nnn}` | |
4007 | |
4008 .. index:: -ff (gnatpp) | |
4009 | |
4010 :switch:`-ff` | |
4011 :switch:`--ff-after-pragma-page` | |
4012 | |
4013 .. index:: -pipe (gnatpp) | |
4014 | |
4015 :switch:`-pipe` | |
4016 :switch:`--pipe` | |
4017 | |
4018 .. index:: -o (gnatpp) | |
4019 | |
4020 :switch:`-o {output-file}` | |
4021 :switch:`--output={output-file}` | |
4022 | |
4023 .. index:: -of (gnatpp) | |
4024 | |
4025 :switch:`-of {output-file}` | |
4026 :switch:`--output-force={output-file}` | |
4027 | |
4028 .. index:: -r (gnatpp) | |
4029 | |
4030 :switch:`-rnb` | |
4031 :switch:`--replace` | |
4032 | |
4033 :switch:`-r` | |
4034 :switch:`--replace-backup` | |
4035 | |
4036 .. index:: -rf (gnatpp) | |
4037 | |
4038 :switch:`-rf` | |
4039 :switch:`--replace-force-backup` | |
4040 | |
4041 .. index:: -rnb (gnatpp) | |
4042 | |
4043 .. index:: --eol (gnatpp) | |
4044 | |
4045 .. index:: -W (gnatpp) | |
4046 | |
4047 :switch:`-W{e}` | |
4048 :switch:`--wide-character-encoding={e}` | |
4049 | |
4050 .. index:: -files (gnatpp) | |
4051 | |
4052 :switch:`-files {filename}` | |
4053 :switch:`--files={filename}` | |
4054 | |
4055 .. index:: -j (gnatpp) | |
4056 | |
4057 :switch:`-j{n}` | |
4058 :switch:`--jobs={n}` | |
4059 | |
4060 .. index:: -v (gnatpp) | |
4061 | |
4062 :switch:`-v` | |
4063 :switch:`--verbose` | |
4064 | |
4065 .. index:: -q (gnatpp) | |
4066 | |
4067 :switch:`-q` | |
4068 :switch:`--quiet` | |
4069 | |
3800 | 4070 |
3801 .. only:: PRO or GPL | 4071 .. only:: PRO or GPL |
3802 | 4072 |
3803 .. _The_Body_Stub_Generator_gnatstub: | 4073 .. _The_Body_Stub_Generator_gnatstub: |
3804 | 4074 |
3855 * *filename* | 4125 * *filename* |
3856 is the name of the source file that contains a library unit declaration | 4126 is the name of the source file that contains a library unit declaration |
3857 for which a body must be created or a library unit body for which subunits | 4127 for which a body must be created or a library unit body for which subunits |
3858 must be created for the body stubs declared in this body. | 4128 must be created for the body stubs declared in this body. |
3859 The file name may contain the path information. | 4129 The file name may contain the path information. |
3860 If the name does not follow GNAT file naming conventions and a set | 4130 If the name does not follow GNAT file naming conventions and the set |
3861 of seitches does not contain a project file that defines naming | 4131 of switches does not contain a project file that defines naming |
3862 conventions, the name of the body file must | 4132 conventions, the name of the body file must |
3863 be provided | 4133 be provided |
3864 explicitly as the value of the :switch:`-o{body-name}` option. | 4134 explicitly as the value of the :switch:`-o{body-name}` option. |
3865 If the file name follows the GNAT file naming | 4135 If the file name follows the GNAT file naming |
3866 conventions and the name of the body file is not provided, | 4136 conventions and the name of the body file is not provided, |
3901 | 4171 |
3902 .. index:: -P (gnatstub) | 4172 .. index:: -P (gnatstub) |
3903 | 4173 |
3904 :switch:`-P {file}` | 4174 :switch:`-P {file}` |
3905 Indicates the name of the project file that describes the set of sources | 4175 Indicates the name of the project file that describes the set of sources |
3906 to be processed. | 4176 to be processed. An aggregate project is allowed as the file parameter only |
4177 if it has exactly one non-aggregate project being aggregated. | |
3907 | 4178 |
3908 | 4179 |
3909 .. index:: -X (gnatstub) | 4180 .. index:: -X (gnatstub) |
3910 | 4181 |
3911 :switch:`-X{name}={value}` | 4182 :switch:`-X{name}={value}` |
3923 | 4194 |
3924 .. index:: --subunits (gnatstub) | 4195 .. index:: --subunits (gnatstub) |
3925 | 4196 |
3926 :switch:`--subunits` | 4197 :switch:`--subunits` |
3927 Generate subunits for body stubs. If this switch is specified, | 4198 Generate subunits for body stubs. If this switch is specified, |
3928 ``gnatstub`` expects a library unit body as an agrument file, | 4199 ``gnatstub`` expects a library unit body as an argument file, |
3929 otherwise a library unit declaration is expected. If a body stub | 4200 otherwise a library unit declaration is expected. If a body stub |
3930 already has a corresponding subunit, ``gnatstub`` does not | 4201 already has a corresponding subunit, ``gnatstub`` does not |
3931 generate anything for it. | 4202 generate anything for it. |
3932 | 4203 |
3933 | 4204 |
4025 | 4296 |
4026 | 4297 |
4027 .. index:: --no-exception (gnatstub) | 4298 .. index:: --no-exception (gnatstub) |
4028 | 4299 |
4029 :switch:`--no-exception` | 4300 :switch:`--no-exception` |
4030 Avoid raising PROGRAM_ERROR in the generated bodies of program unit stubs. | 4301 Avoid raising Program_Error in the generated bodies of program unit stubs, |
4031 This is not always possible for function stubs. | 4302 except in the case of functions, where we have no value to return. |
4032 | 4303 |
4033 | 4304 |
4034 .. index:: --no-local-header (gnatstub) | 4305 .. index:: --no-local-header (gnatstub) |
4035 | 4306 |
4036 :switch:`--no-local-header` | 4307 :switch:`--no-local-header` |
4292 Take as arguments the files listed in text file ``file``. | 4563 Take as arguments the files listed in text file ``file``. |
4293 Text file ``file`` may contain empty lines that are ignored. | 4564 Text file ``file`` may contain empty lines that are ignored. |
4294 Each nonempty line should contain the name of an existing file. | 4565 Each nonempty line should contain the name of an existing file. |
4295 Several such switches may be specified simultaneously. | 4566 Several such switches may be specified simultaneously. |
4296 | 4567 |
4568 .. index:: --ignore (gnattest) | |
4569 | |
4570 :switch:`--ignore={filename}` | |
4571 Do not process the sources listed in a specified file. | |
4572 | |
4297 .. index:: --RTS (gnattest) | 4573 .. index:: --RTS (gnattest) |
4298 | 4574 |
4299 :switch:`--RTS={rts-path}` | 4575 :switch:`--RTS={rts-path}` |
4300 Specifies the default location of the runtime library. Same meaning as the | 4576 Specifies the default location of the runtime library. Same meaning as the |
4301 equivalent ``gnatmake`` flag (:ref:`Switches_for_gnatmake`). For restricted | 4577 equivalent ``gnatmake`` flag (:ref:`Switches_for_gnatmake`). For restricted |
4504 | 4780 |
4505 :switch:`--queues={n}`, :switch:`-j{n}` | 4781 :switch:`--queues={n}`, :switch:`-j{n}` |
4506 Runs ``n`` tests in parallel (default is 1). | 4782 Runs ``n`` tests in parallel (default is 1). |
4507 | 4783 |
4508 | 4784 |
4785 .. index:: --copy-environment (gnattest) | |
4786 | |
4787 :switch:`--copy-environment={dir}` | |
4788 Contents of ``dir`` directory will be copied to temporary directories | |
4789 created by gnattest in which individual test drivers are spawned. | |
4790 | |
4791 | |
4509 .. _Project_Attributes_for_gnattest: | 4792 .. _Project_Attributes_for_gnattest: |
4510 | 4793 |
4511 Project Attributes for ``gnattest`` | 4794 Project Attributes for ``gnattest`` |
4512 ----------------------------------- | 4795 ----------------------------------- |
4513 | 4796 |
4525 This attribute cannot be used together with ``Tests_Root`` or ``Tests_Dir``. | 4808 This attribute cannot be used together with ``Tests_Root`` or ``Tests_Dir``. |
4526 | 4809 |
4527 * ``Tests_Dir`` | 4810 * ``Tests_Dir`` |
4528 is used to select the same output mode as with the ``--tests-dir`` option. | 4811 is used to select the same output mode as with the ``--tests-dir`` option. |
4529 This attribute cannot be used together with ``Subdir`` or ``Tests_Root``. | 4812 This attribute cannot be used together with ``Subdir`` or ``Tests_Root``. |
4813 | |
4814 * ``Stubs_Dir`` | |
4815 is used to select the same output mode as with the ``--stubs-dir`` option. | |
4530 | 4816 |
4531 * ``Harness_Dir`` | 4817 * ``Harness_Dir`` |
4532 is used to specify the directory in which to place harness packages and project | 4818 is used to specify the directory in which to place harness packages and project |
4533 file for the test driver, otherwise specified by ``--harness-dir``. | 4819 file for the test driver, otherwise specified by ``--harness-dir``. |
4534 | 4820 |
5010 adjustments might be necessary to make the test harness compilable; | 5296 adjustments might be necessary to make the test harness compilable; |
5011 * use of some constructs, such as elaboration-control pragmas, Type_Invariant | 5297 * use of some constructs, such as elaboration-control pragmas, Type_Invariant |
5012 aspects, and complex variable initializations that use Subprogram'Access, | 5298 aspects, and complex variable initializations that use Subprogram'Access, |
5013 may result in elaboration circularities in the generated harness. | 5299 may result in elaboration circularities in the generated harness. |
5014 | 5300 |
5301 | |
5302 .. only:: PRO or GPL | |
5303 | |
5304 .. _The_Backtrace_Symbolizer_gnatsymbolize: | |
5305 | |
5306 Translating Code Addresses into Source Locations with ``gnatsymbolize`` | |
5307 ======================================================================= | |
5308 | |
5309 .. index:: ! gnatsymbolize | |
5310 | |
5311 ``gnatsymbolize`` is a program which translates addresses into | |
5312 their corresponding filename, line number, and function names. | |
5313 | |
5314 Running ``gnatsymbolize`` | |
5315 ------------------------- | |
5316 | |
5317 :: | |
5318 | |
5319 $ gnatsymbolize [ switches ] filename [ addresses ] | |
5320 | |
5321 For instance, consider the following Ada program: | |
5322 | |
5323 .. code-block:: ada | |
5324 | |
5325 package Pck is | |
5326 Global_Val : Integer := 0; | |
5327 procedure Call_Me_First; | |
5328 end Pck; | |
5329 | |
5330 with GNAT.IO; use GNAT.IO; | |
5331 with GNAT.Traceback; use GNAT.Traceback; | |
5332 with GNAT.Debug_Utilities; | |
5333 package body Pck is | |
5334 procedure Call_Me_Third is | |
5335 TB : Tracebacks_Array (1 .. 5); | |
5336 TB_len : Natural; | |
5337 begin | |
5338 Global_Val := Global_Val + 1; | |
5339 | |
5340 Call_Chain (TB, TB_Len); | |
5341 for K in 1 .. TB_Len loop | |
5342 Put_Line (GNAT.Debug_Utilities.Image_C (TB (K))); | |
5343 end loop; | |
5344 end Call_Me_Third; | |
5345 | |
5346 procedure Call_Me_Second is | |
5347 begin | |
5348 Call_Me_Third; | |
5349 end Call_Me_Second; | |
5350 | |
5351 procedure Call_Me_First is | |
5352 begin | |
5353 Call_Me_Second; | |
5354 end Call_Me_First; | |
5355 end Pck; | |
5356 with Pck; use Pck; | |
5357 | |
5358 procedure Foo is | |
5359 begin | |
5360 Global_Val := 123; | |
5361 Call_Me_First; | |
5362 end Foo; | |
5363 | |
5364 This program, when built and run, prints a list of addresses which | |
5365 correspond to the traceback when inside function ``Call_Me_Third``. | |
5366 For instance, on x86_64 GNU/Linux: | |
5367 | |
5368 :: | |
5369 | |
5370 $ gnatmake -g -q foo.adb | |
5371 $ ./foo | |
5372 0x0000000000402561 | |
5373 0x00000000004025EF | |
5374 0x00000000004025FB | |
5375 0x0000000000402611 | |
5376 0x00000000004024C7 | |
5377 | |
5378 ``gnatsymbolize`` can be used to translate those addresses into | |
5379 code locations as follow: | |
5380 | |
5381 :: | |
5382 | |
5383 $ gnatsymbolize foo 0x0000000000402561 0x00000000004025EF \ | |
5384 0x00000000004025FB 0x0000000000402611 0x00000000004024C7 | |
5385 Pck.Call_Me_Third at pck.adb:12 | |
5386 Pck.Call_Me_Second at pck.adb:20 | |
5387 Pck.Call_Me_First at pck.adb:25 | |
5388 Foo at foo.adb:6 | |
5389 Main at b~foo.adb:184 | |
5390 | |
5391 Switches for ``gnatsymbolize`` | |
5392 ------------------------------ | |
5393 | |
5394 ``gnatsymbolize`` recognizes the following switches: | |
5395 | |
5396 .. index:: --help (gnatsymbolize) | |
5397 | |
5398 :switch:`--help` | |
5399 Display the program's usage, and then exit, disregarding all other | |
5400 options. | |
5401 | |
5402 :switch:`--cache` | |
5403 Read the symbolic information from the executable and cache them | |
5404 in memory in order to accelerate the translation of each address | |
5405 into a symbolic location. | |
5406 | |
5407 Depending on the size of the executable and the number of addresses | |
5408 to translate, this may not always make ``gnatsymbolize`` faster | |
5409 overall. | |
5410 | |
5411 :switch:`--dump` | |
5412 If :switch:`--cache` is used, dump the contents of the cache on | |
5413 Standard Output. Has no effect otherwise. | |
5414 | |
5415 :switch:`--count={N}` | |
5416 If specified, compute the symbolic traceback ``N`` times in a row. | |
5417 This option is mostly useful for measuring the performance of | |
5418 ``gnatsymbolize``, particularly in the case where the cache is | |
5419 being used. | |
5420 | |
5421 Requirements for Correct Operation | |
5422 ---------------------------------- | |
5423 | |
5424 The translation is performed by reading the DWARF debugging | |
5425 information produced by the compiler for each unit. All units | |
5426 for which the translation is to be done must therefore be compiled | |
5427 such that DWARF debugging information is produced. In most cases, | |
5428 this is done by simply compiling with ``-g``. | |
5429 | |
5430 This program provides a functionality similar to ``addr2line``. | |
5431 It has fewer options to tailor its output, but has been designed | |
5432 to require fewer of the DWARF sections to be present in the | |
5433 executable. In particular, the following sections can be | |
5434 stripped from the executable without impact to ``gnatsymbolize``'s | |
5435 functionality: | |
5436 | |
5437 * ``.debug_str`` | |
5438 * ``.debug_ranges`` | |
5439 | |
5440 | |
5015 .. only:: PRO or GPL | 5441 .. only:: PRO or GPL |
5016 | 5442 |
5017 .. _Using_Project_Files_with_GNAT_Tools: | 5443 .. _Using_Project_Files_with_GNAT_Tools: |
5018 | 5444 |
5019 Using Project Files with GNAT Tools | 5445 Using Project Files with GNAT Tools |