Skip to content

Conversation

@chiangkd
Copy link

On macOS, both <unistd.h> and <string.h> declar swab(), which may result in a conflicting types error due to differences in declaration qualifiers, which can result in a "conflicting types for 'swab'" error during compilation.

According to POSIX, swab() is officially declared in <unistd.h>. macOS also declares it in <string.h> for compatibility, but without proper include guards. This PR resolves the issue by:

  • Reordering includes in util.h to ensure <unistd.h> appears before <string.h>
  • Removing a redundant include in vmstate.c

Tested on macOS 12.1

On macOS, both <unistd.h> and <string.h> declar swab(), which may result in
a conflicting types error due to differences in declaration qualifiers.

According to POSIX, swab() is officially declared in <unistd.h>. macOS also
declares it in <string.h> for compatibility, but without proper include
guards. This PR resolves the issue by:
- Reordering includes in util.h to ensure <unistd.h> appears before <string.h>
- Removing a redundant include in vmstate.c

Tested on macOS 12.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant