From 4d757068c4784a18026089fd812949703bd9470a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 6 Dec 2022 01:48:58 -0800 Subject: Avoid using a macro to wrap standard attributes --- alc/backends/jack.cpp | 4 ++-- alc/backends/opensl.cpp | 12 ++++++------ alc/backends/pipewire.cpp | 14 +++++++------- alc/backends/pulseaudio.cpp | 24 ++++++++++++------------ 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'alc/backends') diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index afa26b23..cbe1184d 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -340,7 +340,7 @@ int JackPlayback::processRt(jack_nframes_t numframes) noexcept out[numchans++] = static_cast(jack_port_get_buffer(port, numframes)); } - if(mPlaying.load(std::memory_order_acquire)) [[allikely]] + if(mPlaying.load(std::memory_order_acquire)) [[likely]] mDevice->renderSamples({out.data(), numchans}, static_cast(numframes)); else { @@ -364,7 +364,7 @@ int JackPlayback::process(jack_nframes_t numframes) noexcept } jack_nframes_t total{0}; - if(mPlaying.load(std::memory_order_acquire)) [[allikely]] + if(mPlaying.load(std::memory_order_acquire)) [[likely]] { auto data = mRing->getReadVector(); jack_nframes_t todo{minu(numframes, static_cast(data.first.len))}; diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp index 901d2ebe..b3c90880 100644 --- a/alc/backends/opensl.cpp +++ b/alc/backends/opensl.cpp @@ -147,9 +147,9 @@ const char *res_str(SLresult result) noexcept return "Unknown error code"; } -#define PRINTERR(x, s) do { \ - if((x) != SL_RESULT_SUCCESS) [[alunlikely]] \ - ERR("%s: %s\n", (s), res_str((x))); \ +#define PRINTERR(x, s) do { \ + if((x) != SL_RESULT_SUCCESS) [[unlikely]] \ + ERR("%s: %s\n", (s), res_str((x))); \ } while(0) @@ -916,12 +916,12 @@ void OpenSLCapture::captureSamples(al::byte *buffer, uint samples) } SLAndroidSimpleBufferQueueItf bufferQueue{}; - if(mDevice->Connected.load(std::memory_order_acquire)) [[allikely]] + if(mDevice->Connected.load(std::memory_order_acquire)) [[likely]] { const SLresult result{VCALL(mRecordObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, &bufferQueue)}; PRINTERR(result, "recordObj->GetInterface"); - if(SL_RESULT_SUCCESS != result) [[alunlikely]] + if(SL_RESULT_SUCCESS != result) [[unlikely]] { mDevice->handleDisconnect("Failed to get capture buffer queue: 0x%08x", result); bufferQueue = nullptr; @@ -942,7 +942,7 @@ void OpenSLCapture::captureSamples(al::byte *buffer, uint samples) SLresult result{SL_RESULT_SUCCESS}; auto wdata = mRing->getWriteVector(); - if(adv_count > wdata.second.len) [[allikely]] + if(adv_count > wdata.second.len) [[likely]] { auto len1 = std::min(wdata.first.len, adv_count-wdata.second.len); auto buf1 = wdata.first.buf + chunk_size*(wdata.first.len-len1); diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp index 48a1cb10..0539e0c9 100644 --- a/alc/backends/pipewire.cpp +++ b/alc/backends/pipewire.cpp @@ -474,7 +474,7 @@ struct EventManager { */ void waitForInit() { - if(!mInitDone.load(std::memory_order_acquire)) [[alunlikely]] + if(!mInitDone.load(std::memory_order_acquire)) [[unlikely]] { MainloopUniqueLock plock{mLoop}; plock.wait([this](){ return mInitDone.load(std::memory_order_acquire); }); @@ -857,7 +857,7 @@ void NodeProxy::infoCallback(const pw_node_info *info) { /* Can this actually change? */ const char *media_class{spa_dict_lookup(info->props, PW_KEY_MEDIA_CLASS)}; - if(!media_class) [[alunlikely]] return; + if(!media_class) [[unlikely]] return; NodeType ntype{}; if(al::strcasecmp(media_class, AudioSinkClass) == 0) @@ -901,7 +901,7 @@ void NodeProxy::paramCallback(int, uint32_t id, uint32_t, uint32_t, const spa_po if(id == SPA_PARAM_EnumFormat) { DeviceNode *node{DeviceNode::Find(mId)}; - if(!node) [[alunlikely]] return; + if(!node) [[unlikely]] return; if(const spa_pod_prop *prop{spa_pod_find_prop(param, nullptr, SPA_FORMAT_AUDIO_rate)}) node->parseSampleRate(&prop->value); @@ -1326,7 +1326,7 @@ void PipeWirePlayback::ioChangedCallback(uint32_t id, void *area, uint32_t size) void PipeWirePlayback::outputCallback() { pw_buffer *pw_buf{pw_stream_dequeue_buffer(mStream.get())}; - if(!pw_buf) [[alunlikely]] return; + if(!pw_buf) [[unlikely]] return; const al::span datas{pw_buf->buffer->datas, minu(mNumChannels, pw_buf->buffer->n_datas)}; @@ -1342,7 +1342,7 @@ void PipeWirePlayback::outputCallback() uint length{mRateMatch ? mRateMatch->size : 0u}; #endif /* If no length is specified, use the device's update size as a fallback. */ - if(!length) [[alunlikely]] length = mDevice->UpdateSize; + if(!length) [[unlikely]] length = mDevice->UpdateSize; /* For planar formats, each datas[] seems to contain one channel, so store * the pointers in an array. Limit the render length in case the available @@ -1713,7 +1713,7 @@ ClockLatency PipeWirePlayback::getClockLatency() */ nanoseconds monoclock{seconds{tspec.tv_sec} + nanoseconds{tspec.tv_nsec}}; nanoseconds curtic{}, delay{}; - if(ptime.rate.denom < 1) [[alunlikely]] + if(ptime.rate.denom < 1) [[unlikely]] { /* If there's no stream rate, the stream hasn't had a chance to get * going and return time info yet. Just use dummy values. @@ -1811,7 +1811,7 @@ void PipeWireCapture::stateChangedCallback(pw_stream_state, pw_stream_state, con void PipeWireCapture::inputCallback() { pw_buffer *pw_buf{pw_stream_dequeue_buffer(mStream.get())}; - if(!pw_buf) [[alunlikely]] return; + if(!pw_buf) [[unlikely]] return; spa_data *bufdata{pw_buf->buffer->datas}; const uint offset{minu(bufdata->chunk->offset, bufdata->maxsize)}; diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 7f8a8fb3..0e9bf268 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -688,7 +688,7 @@ void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) noexce pa_free_cb_t free_func{nullptr}; auto buflen = static_cast(-1); void *buf{}; - if(pa_stream_begin_write(stream, &buf, &buflen) || !buf) [[alunlikely]] + if(pa_stream_begin_write(stream, &buf, &buflen) || !buf) [[unlikely]] { buflen = nbytes; buf = pa_xmalloc(buflen); @@ -701,7 +701,7 @@ void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) noexce mDevice->renderSamples(buf, static_cast(buflen/mFrameSize), mSpec.channels); int ret{pa_stream_write(stream, buf, buflen, free_func, 0, PA_SEEK_RELATIVE)}; - if(ret != PA_OK) [[alunlikely]] + if(ret != PA_OK) [[unlikely]] ERR("Failed to write to stream: %d, %s\n", ret, pa_strerror(ret)); } while(nbytes > 0); } @@ -1046,7 +1046,7 @@ ClockLatency PulsePlayback::getClockLatency() err = pa_stream_get_latency(mStream, &latency, &neg); } - if(err != 0) [[alunlikely]] + if(err != 0) [[unlikely]] { /* If err = -PA_ERR_NODATA, it means we were called too soon after * starting the stream and no timing info has been received from the @@ -1057,7 +1057,7 @@ ClockLatency PulsePlayback::getClockLatency() latency = mDevice->BufferSize - mDevice->UpdateSize; neg = 0; } - else if(neg) [[alunlikely]] + else if(neg) [[unlikely]] latency = 0; ret.Latency = std::chrono::microseconds{latency}; @@ -1284,7 +1284,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples) if(!mCapBuffer.empty()) { const size_t rem{minz(dstbuf.size(), mCapBuffer.size())}; - if(mCapLen < 0) [[alunlikely]] + if(mCapLen < 0) [[unlikely]] std::fill_n(dstbuf.begin(), rem, mSilentVal); else std::copy_n(mCapBuffer.begin(), rem, dstbuf.begin()); @@ -1294,7 +1294,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples) continue; } - if(!mDevice->Connected.load(std::memory_order_acquire)) [[alunlikely]] + if(!mDevice->Connected.load(std::memory_order_acquire)) [[unlikely]] break; MainloopUniqueLock plock{mMainloop}; @@ -1305,14 +1305,14 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples) mCapLen = 0; } const pa_stream_state_t state{pa_stream_get_state(mStream)}; - if(!PA_STREAM_IS_GOOD(state)) [[alunlikely]] + if(!PA_STREAM_IS_GOOD(state)) [[unlikely]] { mDevice->handleDisconnect("Bad capture state: %u", state); break; } const void *capbuf; size_t caplen; - if(pa_stream_peek(mStream, &capbuf, &caplen) < 0) [[alunlikely]] + if(pa_stream_peek(mStream, &capbuf, &caplen) < 0) [[unlikely]] { mDevice->handleDisconnect("Failed retrieving capture samples: %s", pa_strerror(pa_context_errno(mContext))); @@ -1321,7 +1321,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples) plock.unlock(); if(caplen == 0) break; - if(!capbuf) [[alunlikely]] + if(!capbuf) [[unlikely]] mCapLen = -static_cast(caplen); else mCapLen = static_cast(caplen); @@ -1339,7 +1339,7 @@ uint PulseCapture::availableSamples() { MainloopUniqueLock plock{mMainloop}; size_t got{pa_stream_readable_size(mStream)}; - if(static_cast(got) < 0) [[alunlikely]] + if(static_cast(got) < 0) [[unlikely]] { const char *err{pa_strerror(static_cast(got))}; ERR("pa_stream_readable_size() failed: %s\n", err); @@ -1370,13 +1370,13 @@ ClockLatency PulseCapture::getClockLatency() err = pa_stream_get_latency(mStream, &latency, &neg); } - if(err != 0) [[alunlikely]] + if(err != 0) [[unlikely]] { ERR("Failed to get stream latency: 0x%x\n", err); latency = 0; neg = 0; } - else if(neg) [[alunlikely]] + else if(neg) [[unlikely]] latency = 0; ret.Latency = std::chrono::microseconds{latency}; -- cgit v1.2.3