alt_warning.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef __WARNING_H__
  2. #define __WARNING_H__
  3. /******************************************************************************
  4. * *
  5. * License Agreement *
  6. * *
  7. * Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
  8. * All rights reserved. *
  9. * *
  10. * Permission is hereby granted, free of charge, to any person obtaining a *
  11. * copy of this software and associated documentation files (the "Software"), *
  12. * to deal in the Software without restriction, including without limitation *
  13. * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
  14. * and/or sell copies of the Software, and to permit persons to whom the *
  15. * Software is furnished to do so, subject to the following conditions: *
  16. * *
  17. * The above copyright notice and this permission notice shall be included in *
  18. * all copies or substantial portions of the Software. *
  19. * *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
  21. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
  22. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
  23. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
  24. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
  25. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
  26. * DEALINGS IN THE SOFTWARE. *
  27. * *
  28. * This agreement shall be governed in all respects by the laws of the State *
  29. * of California and by the laws of the United States of America. *
  30. * *
  31. ******************************************************************************/
  32. /*
  33. * alt_warning.h provides macro definitions that can be used to generate link
  34. * time warnings.
  35. */
  36. #ifdef __cplusplus
  37. extern "C"
  38. {
  39. #endif /* __cplusplus */
  40. /*
  41. * The symbol "__alt_invalid" is used to force a link error. There should be
  42. * no corresponding implementation of this function.
  43. */
  44. extern void __alt_invalid (void);
  45. #define ALT_LINK_WARNING(symbol, msg) \
  46. __asm__(".ifndef __evoke_link_warning_" #symbol \
  47. "\n\t .section .gnu.warning." #symbol \
  48. "\n__evoke_link_warning_" #symbol ":\n\t .string \x22" msg "\x22 \n\t .previous" \
  49. "\n .endif");
  50. /* A canned warning for sysdeps/stub functions. */
  51. #define ALT_STUB_WARNING(name) \
  52. ALT_LINK_WARNING (name, \
  53. "warning: " #name " is not implemented and will always fail")
  54. #define ALT_OBSOLETE_FUNCTION_WARNING(name) \
  55. ALT_LINK_WARNING (name, \
  56. "warning: " #name " is a deprecated function")
  57. #define ALT_LINK_ERROR(msg) \
  58. ALT_LINK_WARNING (__alt_invalid, msg); \
  59. __alt_invalid()
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif /* __WARNING_H__ */