attributes.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * Attributes for different compilers
  3. *
  4. * @author Tilen Majerle
  5. * @email tilen@majerle.eu
  6. * @website http://stm32f4-discovery.com
  7. * @version v1.0
  8. * @ide Keil uVision 5
  9. * @license GNU GPL v3
  10. *
  11. * |----------------------------------------------------------------------
  12. * | Copyright (C) Tilen Majerle, 2014
  13. * |
  14. * | This program is free software: you can redistribute it and/or modify
  15. * | it under the terms of the GNU General Public License as published by
  16. * | the Free Software Foundation, either version 3 of the License, or
  17. * | any later version.
  18. * |
  19. * | This program is distributed in the hope that it will be useful,
  20. * | but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * | GNU General Public License for more details.
  23. * |
  24. * | You should have received a copy of the GNU General Public License
  25. * | along with this program. If not, see <http://www.gnu.org/licenses/>.
  26. * |----------------------------------------------------------------------
  27. *
  28. * Different compilers uses different special keywords for functions/variables. etc.
  29. * For this purpose that file has been made. On one place to all possible attributes used in my libs.
  30. */
  31. #ifndef TM_ATTRIBUTES_H
  32. #define TM_ATTRIBUTES_H
  33. /* Check for GNUC */
  34. #if defined (__GNUC__)
  35. #ifndef __weak
  36. #define __weak __attribute__((weak))
  37. #endif /* Weak attribute */
  38. #ifndef __packed
  39. #define __packed __attribute__((__packed__))
  40. #endif /* Packed attribute */
  41. #endif
  42. #endif