This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Assume that __BYTE_ORDER__ is always present
ClosedPublic

Authored by philnik on Aug 17 2023, 1:59 PM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rG0a97720d0197: [libc++] Assume that __BYTE_ORDER__ is always present
Summary

Both Clang and GCC always define BYTE_ORDER, so there is no need to test the byte order a million different ways.

Diff Detail

Event Timeline

philnik created this revision.Aug 17 2023, 1:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2023, 1:59 PM
Herald added a subscriber: krytarowski. · View Herald Transcript
philnik published this revision for review.Aug 18 2023, 3:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2023, 3:35 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Sep 1 2023, 8:43 AM
ldionne added a subscriber: ldionne.

LGTM with suggestion applied.

libcxx/include/__config
428

Can we do something like

#ifndef __BYTE_ORDER__
#error "Your compiler doesn't seem to define __BYTE_ORDER__, which is required by libc++ to know the endianness of your target platform
#endif

This will catch any failure to satisfy our assumptions here.

This revision is now accepted and ready to land.Sep 1 2023, 8:43 AM
This revision was automatically updated to reflect the committed changes.
philnik marked an inline comment as done.