Ignore:
Timestamp:
Oct 2, 2022, 10:00:43 PM (6 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
815943f
Parents:
f704974 (diff), f92e7b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/stdhdr/assert.h

    rf704974 rae151cf  
    2727        #define assertf( expr, fmt, ... ) ((expr) ? ((void)0) : __assert_fail_f(__VSTRINGIFY__(expr), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, ## __VA_ARGS__ ))
    2828
     29        void __assert_warn_f( const char assertion[], const char file[], unsigned int line, const char function[], const char fmt[], ... ) __attribute__((format( printf, 5, 6) ));
    2930        void __assert_fail_f( const char assertion[], const char file[], unsigned int line, const char function[], const char fmt[], ... ) __attribute__((noreturn, format( printf, 5, 6) ));
    3031#endif
    3132
    3233#if !defined(NDEBUG) && (defined(__CFA_DEBUG__) || defined(__CFA_VERIFY__))
     34        #define __CFA_WITH_VERIFY__
    3335        #define verify(x) assert(x)
    3436        #define verifyf(x, ...) assertf(x, __VA_ARGS__)
    3537        #define verifyfail(...)
    36         #define __CFA_WITH_VERIFY__
     38        #define warnf( expr, fmt, ... ) ({ static bool check_once##__LINE__ = false; if( false == check_once##__LINE__ && false == (expr)) { check_once##__LINE__ = true; __assert_warn_f(__VSTRINGIFY__(expr), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, ## __VA_ARGS__ ); } })
    3739#else
    3840        #define verify(x)
    3941        #define verifyf(x, ...)
    4042        #define verifyfail(...)
     43        #define warnf( expr, fmt, ... )
    4144#endif
    4245
Note: See TracChangeset for help on using the changeset viewer.