1
0

Gcc.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* vim: set expandtab ts=4 sw=4: */
  2. /*
  3. * You may redistribute this program and/or modify it under the terms of
  4. * the GNU General Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #ifndef Gcc_H
  16. #define Gcc_H
  17. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4))
  18. #define Gcc_PRINTF( format_idx, arg_idx ) \
  19. __attribute__((__format__ (__printf__, format_idx, arg_idx)))
  20. #define Gcc_NORETURN \
  21. __attribute__((__noreturn__))
  22. #define Gcc_NONNULL(...) \
  23. __attribute__((__nonnull__(__VA_ARGS__)))
  24. #define Gcc_PURE \
  25. __attribute__ ((__pure__))
  26. #else
  27. #define Gcc_PRINTF( format_idx, arg_idx )
  28. #define Gcc_NORETURN
  29. #define Gcc_NONNULL(num)
  30. #define Gcc_PURE
  31. #endif
  32. #define Gcc_SHORT_FILE <?js return '"'+__FILE__.substring(__FILE__.lastIndexOf('/')+1)+'"'; ?>
  33. #define Gcc_LINE __LINE__
  34. Gcc_PRINTF(1,2)
  35. static inline void Gcc_checkPrintf(const char* format, ...)
  36. {
  37. // This does nothing except to trigger warnings if the format is wrong.
  38. }
  39. #endif