Including C system headers through a Swift Package

You can copy the contents of iso646.h directly into your header - Minimis.h. And that’s how a #include directive works.

Here is what I found:
If we do not change the content, it will be the same as if we still use #include "iso646.h". And the build will fail.

By modifying #ifndef __ISO646_H to something else, it will be valid to use and in the header.

// Minimis.h
#import <Foundation/Foundation.h>
FOUNDATION_EXPORT double MinimisVersionNumber;
FOUNDATION_EXPORT const unsigned char MinimisVersionString[];
#ifndef __ISO646_H2
#define __ISO646_H2
#ifndef __cplusplus
#define and    &&
#endif
#endif
#if A and B
    #pragma message ("A and B are defined")
#else
    #warning Neither A nor B are defined
#endif
void f(void);

Therefore, it seems that the __ISO646_H has been defined when processing this file. So I update it to the following to try to find where is the previous define.

// Minimis.h
...
#ifndef __ISO646_H2
#define __ISO646_H
...

As expected, I get a warning complaining '__ISO646_H' macro redefined

Here is the final result:

/Users/kyle/Downloads/DemoLib/Sources/Minimis/include/Minimis.h:13:9: warning: '__ISO646_H' macro redefined
#define __ISO646_H
        ^
<command line>:3:9: note: previous definition is here
#define __ISO646_H 1
        ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/kyle/Downloads/DemoLib/Sources/Minimis/include/Minimis.h"

The log is hinting me it was previously defined in command line. But I could not see it in the compile command. :thinking: