ppc_define.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Multi-include test program
  3. * ensure that pixel, bool and vector are not redefined
  4. *
  5. * Copyright (C) 2020 Yann Collet
  6. *
  7. * GPL v2 License
  8. *
  9. * This program 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 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program 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 along
  20. * with this program; if not, write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  22. *
  23. * You can contact the author at:
  24. * - xxHash homepage: https://www.xxhash.com
  25. * - xxHash source repository: https://github.com/Cyan4973/xxHash
  26. */
  27. /* gcc's altivec.h, included for the VSX code path,
  28. * may, in some circumstances, redefine
  29. * bool, vector and pixel keywords.
  30. *
  31. * This unit checks if it happens.
  32. * It's a compile test.
  33. * The test is mostly meaningful for PPC target using altivec.h
  34. * hence XXH_VECTOR == XXH_VSX
  35. */
  36. #define BOOL_VALUE 32123456
  37. #define bool BOOL_VALUE
  38. #define VECTOR_VALUE 374464784
  39. #define vector VECTOR_VALUE
  40. #define PIXEL_VALUE 5846841
  41. #define pixel PIXEL_VALUE
  42. #define XXH_INLINE_ALL
  43. #include "../xxhash.h"
  44. #if (bool != BOOL_VALUE)
  45. # error "bool macro was redefined !"
  46. #endif
  47. #if (vector != VECTOR_VALUE)
  48. # error "vector macro was redefined !"
  49. #endif
  50. #if (pixel != PIXEL_VALUE)
  51. # error "pixel macro was redefined !"
  52. #endif
  53. int g_nonEmptyUnit = 0;