VirtualScanner sample fails to compile

Hi,


I just learned that sample for VirtualScanner that can be downloaded from https://developer.apple.com/library/content/samplecode/VirtualScanner/VirtualScanner.zip


XCode: Version 9.2 (9C40b)


VirtualScanner.m:733:28: Use of undeclared identifier 'bail'


Any hints?

Looks like a very old (2012) code ; and things seem to have changed in the syntax since (macros were defined in 2006).


Problem is in instructions as:


  require_action(paramDict, bail, err = paramErr);


I found in h ttps://opensource.apple.com/source/xnu/xnu-2050.7.9/EXTERNAL_HEADERS/AssertMacros.h

Definition of require_action macro:


/
*  require_action(assertion, exceptionLabel, action)
*
*  Summary:
*    Production builds: if the assertion expression evaluates to false,
*    execute the action statement or compound statement (block) and then
*    goto exceptionLabel.
*
*    Non-production builds: if the assertion expression evaluates to false,
*    call DEBUG_ASSERT_MESSAGE, execute the action statement or compound
*    statement (block), and then goto exceptionLabel.
*
*  Parameters:
*
*    assertion:
*      The assertion expression.
*
*    exceptionLabel:
*      The label.
*
*    action:
*      The statement or compound statement (block).
*/
#if DEBUG_ASSERT_PRODUCTION_CODE
   #define require_action(assertion, exceptionLabel, action)                  \
      do                                                                      \
      {                                                                       \
          if ( __builtin_expect(!(assertion), 0) )                            \
          {                                                                   \
              {                                                               \
                  action;                                                     \
              }                                                               \
              goto exceptionLabel;                                            \
          }                                                                   \
      } while ( 0 )
#else
   #define require_action(assertion, exceptionLabel, action)                  \
      do                                                                      \
      {                                                                       \
          if ( __builtin_expect(!(assertion), 0) )                            \
          {                                                                   \
              DEBUG_ASSERT_MESSAGE(                                           \
                  DEBUG_ASSERT_COMPONENT_NAME_STRING,                         \
                  #assertion,                                                 \
                  #exceptionLabel,                                            \
                  0,                                                          \
                  __FILE__,                                                   \
                  __LINE__,                                                   \
                  0);                                                         \
              {                                                               \
                  action;                                                     \
              }                                                               \
              goto exceptionLabel;                                            \
          }                                                                   \
      } while ( 0 )
#endif



So bail, is a label, but did not see how to make it visible for require_action

Old topic but maybe will help someone.

"require_action" has been changed to "__Require_Action"

https://stackoverflow.com/questions/46221364/xcode-9-throws-errors-involving-require

VirtualScanner sample fails to compile
 
 
Q