Skip to content

Provide a well-defined off_t type across different operating system platforms. #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Bill-hbrhbr opened this issue Mar 31, 2025 · 0 comments · Fixed by #52
Closed

Provide a well-defined off_t type across different operating system platforms. #50

Bill-hbrhbr opened this issue Mar 31, 2025 · 0 comments · Fixed by #52
Assignees
Labels
bug Something isn't working

Comments

@Bill-hbrhbr
Copy link
Collaborator

Bill-hbrhbr commented Mar 31, 2025

Bug

off_t lives under <sys/types.h> for Linux platforms. However, on MacOS platforms, this is not the case, and clang-tidy will generate misc-include-cleaner warnings.

2 warnings treated as errors
/Users/runner/work/ystdlib-cpp/ystdlib-cpp/src/ystdlib/io_interface/StreamInterface.hpp:4:1: error: included header types.h is not used directly [misc-include-cleaner,-warnings-as-errors]
    4 | #include <sys/types.h>
      | ^~~~~~~~~~~~~~~~~~~~~~
    5 | 
/Users/runner/work/ystdlib-cpp/ystdlib-cpp/src/ystdlib/io_interface/StreamInterface.hpp:55:50: error: no header providing "off_t" is directly included [misc-include-cleaner,-warnings-as-errors]
    4 |     [[nodiscard]] virtual auto seek_from_current(off_t offset)
      |                                                  ^
task: Failed to run task "lint:check": exit status 1

This issue is first encountered when clang-tidying the ReaderInterface and WriterInterface classes in the io_interface library (#49). We've left NOLINTs and TODOs in the code to silence the warnings.

One solution is to create our own versions of the system headers for portability and platform-specific handling. See also.

ystdlib-cpp version

0.0.0

Environment

Warnings generated on MacOS-15.

Reproduction steps

Remove the NOLINT lines added in (#49), and run clang-tidy on MacOS-15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant