cameron314 / concurrentqueue

A fast multi-producer, multi-consumer lock-free concurrent queue for C++11
Other
9.87k stars 1.69k forks source link

inlining failed in call #291

Closed maxima120 closed 2 years ago

maxima120 commented 2 years ago

I just ran your sample as:

    moodycamel::ConcurrentQueue<int> q;
    q.enqueue(25);

    int item;
    bool found = q.try_dequeue(item);
    printf("QUEUE: (%d) DATA: %d\n", found, item);

and got warning while compiling:

concurrentqueue.h:2492:29: warning: inlining failed in call to ‘bool moodycamel::ConcurrentQueue<T, Traits>::ImplicitProducer::enqueue(U&&) [with moodycamel::ConcurrentQueue<T, Traits>::AllocationMode allocMode = moodycamel::ConcurrentQueue<int, moodycamel::ConcurrentQueueDefaultTraits>::CanAlloc; U = int; T = int; Traits = moodycamel::ConcurrentQueueDefaultTraits]’: --param max-inline-insns-single limit reached [-Winline]
 2492 |                 inline bool enqueue(U&& element)
      |                             ^~~~~~~
concurrentqueue.h:1381:125: note: called from here
 1381 |                 return producer == nullptr ? false : producer->ConcurrentQueue::ImplicitProducer::template enqueue<canAlloc>(std::forward<U>(element));
      |                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

I would like to have no warnings. Could someone please help - can I inline without warnings or shall i remove all inline specifiers?

cameron314 commented 2 years ago

Never seen this one before.

Try passing -finline-limit=2048 or progressively higher values until the warning goes away.

maxima120 commented 2 years ago

sorry it was my fault. I commented out #pragma once (for unknown reason :))