testsppreplaced.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* testsppreplaced.c --- unit test for CPP/SPP Replacement
  2. Copyright (C) 2007-2012 Free Software Foundation, Inc.
  3. Author: Eric M. Ludlam <eric@siege-engine.com>
  4. This file is part of GNU Emacs.
  5. GNU Emacs is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. GNU Emacs is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. /* What the SPP replace file would looklike with MACROS replaced: */
  17. /* TEST: The EMU keyword doesn't screw up the function defn. */
  18. char parse_around_emu ()
  19. {
  20. }
  21. /* TEST: A simple word can be replaced in a definition. */
  22. float returnanfloat()
  23. {
  24. }
  25. /* TEST: Punctuation an be replaced in a definition. */
  26. int foo::bar ()
  27. {
  28. }
  29. /* TEST: Multiple lexical characters in a definition */
  30. int mysuper::baz ()
  31. {
  32. }
  33. /* TEST: Macro replacement. */
  34. int increment (int in) {
  35. return in+1;
  36. }
  37. /* TEST: Macro replacement with complex args */
  38. int myFcn1 ();
  39. int myFcn2 (int a, int b);
  40. int myFcn3 (int a, int b);
  41. /* TEST: Multiple args to a macro. */
  42. struct ma_struct { int moose; int penguin; int emu; };
  43. /* TEST: Macro w/ args, but no body. */
  44. /* TEST: Not a macro with args, but close. */
  45. int not_with_args_fcn (moose)
  46. {
  47. }
  48. /* TEST: macro w/ continuation. */
  49. int continuation_symbol () { };
  50. /* TEST: macros in a macro - tail processing */
  51. int tail (int q) {}
  52. /* TEST: macros used improperly */
  53. int tail_fcn(int q);
  54. /* TEST: feature of CPP from LSD <lsdsgster@...> */
  55. int __gthrw_foo (int arg1) { }
  56. /* TEST: macros using macros */
  57. int foo;
  58. /* TEST: macros with args using macros */
  59. int noodle(int noodle);
  60. /* TEST: Double macro using the argument stack. */
  61. int that_foo(int i);
  62. int this_foo(int i);
  63. /* TEST: The G++ namespace macro hack. Not really part of SPP. */
  64. namespace baz {
  65. int bazfnc(int b) { }
  66. }
  67. namespace foo { namespace bar {
  68. int foo_bar_func(int a) { }
  69. }
  70. }
  71. /* TEST: The VC++ macro hack. */
  72. namespace std {
  73. int inside_std_namespace(int a) { }
  74. }
  75. /* TEST: Recursion prevention. CPP doesn't allow even 1 level of recursion. */
  76. int MACROA () {
  77. }
  78. /* End */