1 /** test-fmt.cpp --- Signatures, and format answers for testing 2 * 3 * Copyright (C) 2012, 2016, 2019-2023 Free Software Foundation, Inc. 4 * 5 * Author: Eric M. Ludlam <zappo@gnu.org> 6 * 7 * This file is part of GNU Emacs. 8 * 9 * GNU Emacs is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation, either version 3 of the License, or 12 * (at your option) any later version. 13 * 14 * GNU Emacs is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. 21 */ 22 23 /* 24 * About semantic-fmt-utest : 25 * 26 * These tests validate two features: 27 * 1) The C++ parser can parse the different signatures 28 * 2) The semantic-tag-format-* functions can recreate them. 29 * 30 */ 31 32 void basic_fcn() { } 33 /* 34 * ## name "basic_fcn" 35 * ## abbreviate "basic_fcn()" 36 * ## prototype "void basic_fcn ()" 37 * ## uml-prototype "basic_fcn () : void" 38 */ 39 40 int twoargs_fcn(int a, char b) { } 41 /* 42 * ## name "twoargs_fcn" 43 * ## abbreviate "twoargs_fcn()" 44 * ## prototype "int twoargs_fcn (int a,char b)" 45 * ## uml-prototype "twoargs_fcn (a : int,b : char) : int" 46 */ 47 48 struct moose { 49 int field1; 50 char field2; 51 }; 52 /* 53 * ## name "moose" 54 * ## abbreviate "moose{}" 55 * ## prototype "struct moose {}" 56 * ## uml-prototype "moose{} : struct" 57 */ 58 59 struct moose struct_fcn ( struct moose in, char *out); 60 /* 61 * ## name "struct_fcn" 62 * ## abbreviate "struct_fcn()" 63 * ## prototype "struct moose struct_fcn (struct moose in,char* out)" 64 * ## uml-prototype "struct_fcn (in : struct moose,out : char*) : struct moose" 65 */ 66 67 struct moose *var_one = NULL; 68 /* 69 * ## name "var_one" 70 * ## summarize "Variables: struct moose* var_one[=NULL]" 71 * ## prototype "struct moose* var_one[=NULL]" 72 * ## uml-prototype "var_one : struct moose*" 73 */ 74 75 const int var_two = 1; 76 /* 77 * ## name "var_two" 78 * ## summarize "Variables: const int var_two[=1]" 79 * ## prototype "const int var_two[=1]" 80 * ## uml-prototype "var_two : int" 81 */ 82 83 namespace NS { 84 enum TestEnum {a,b}; 85 } 86 /* 87 * ## name "NS" 88 * ## summarize "Types: namespace NS {}" 89 * ## prototype "namespace NS {}" 90 * ## uml-prototype "NS{} : namespace" 91 */ 92 93 94 // void func_ns_arg(NS::TestEnum v = NS::a); <<--- TODO - bring FIX from CEDET on SF 95 /* 96 * # # name "func_ns_arg" 97 * # # summarize "Functions: void func_ns_arg (NS::TestEnum v[=NS::a])" 98 * # # prototype "void func_ns_arg (NS::TestEnum v[=NS::a])" 99 * # # uml-prototype "func_ns_arg (v : NS::TestEnum) : void" 100 */ 101 102 //int const var_three = 1; 103 /* 104 * # # name "var_three" 105 * # # summarize "Variables: int const var_three" <-- this fails 106 * # # prototype "int const var_three" <-- this fails 107 * # # uml-prototype "var_three : int" 108 */