test_anon_struct.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* This file is part of asmc, a bootstrapping OS with minimal seed
  2. Copyright (C) 2018 Giovanni Mascellani <gio@debian.org>
  3. https://gitlab.com/giomasce/asmc
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  14. struct S {
  15. struct {
  16. int x, y;
  17. };
  18. union {
  19. int z, w;
  20. };
  21. };
  22. union A {
  23. int x;
  24. int y;
  25. struct {
  26. char x1;
  27. int y1;
  28. };
  29. struct {
  30. char x2;
  31. int y2;
  32. } other;
  33. struct {
  34. char x3;
  35. int y3;
  36. struct {
  37. char x4;
  38. int y4;
  39. };
  40. };
  41. };
  42. // Nothing to test here (for the moment), we just check that the file
  43. // compiles; in line of principle one could add behaviour tests
  44. int test_anon_struct() {
  45. return 1;
  46. }