Skip to content

Commit

Permalink
add unlikely attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
MacroModel committed Dec 12, 2024
1 parent 4619a9d commit 96be610
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions include/fast_io_hosted/process/process/posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ inline posix_wait_status posix_waitpid(pid_t pid)
#if defined(__linux__) && defined(__NR_wait4)
system_call_throw_error(system_call<__NR_wait4, int>(pid, __builtin_addressof(status.wait_loc), 0, nullptr));
#else
if (::fast_io::posix::libc_waitpid(pid, __builtin_addressof(status.wait_loc), 0) == -1)
if (::fast_io::posix::libc_waitpid(pid, __builtin_addressof(status.wait_loc), 0) == -1) [[unlikely]]
{
throw_posix_error();
}
Expand Down Expand Up @@ -178,12 +178,12 @@ struct io_redirector
{
return_code rc;
rc = redirect(0, pio.in);
if (rc.error)
if (rc.error) [[unlikely]]
{
return rc;
}
rc = redirect(1, pio.out);
if (rc.error)
if (rc.error) [[unlikely]]
{
return rc;
}
Expand Down Expand Up @@ -219,7 +219,7 @@ struct io_redirector
{
rc = sys_dup2_nothrow(d.fd, target_fd);
}
if (rc.error)
if (rc.error) [[unlikely]]
{
return rc;
}
Expand Down
1 change: 0 additions & 1 deletion include/fast_io_legacy_impl/c/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,6 @@ using c_file_factory_unlocked = c_family_file_factory<c_family::native_unlocked>

namespace freestanding
{

template <c_family fm, ::std::integral char_type>
struct is_trivially_relocatable<basic_c_family_file<fm, char_type>>
{
Expand Down

0 comments on commit 96be610

Please sign in to comment.