[Bug c/66918] Disable "inline function declared but never defined" warning

2022-12-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

Andrew Pinski  changed:

   What|Removed |Added

 CC||msebor at gcc dot gnu.org

--- Comment #12 from Andrew Pinski  ---
*** Bug 100343 has been marked as a duplicate of this bug. ***

[Bug c/66918] Disable "inline function declared but never defined" warning

2021-11-14 Thread oficsu at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

Ofee Oficsu  changed:

   What|Removed |Added

 CC||oficsu at gmail dot com

--- Comment #11 from Ofee Oficsu  ---
There's another example. A bit suspicious as it's related to loopholes, but GCC
produces too many warning on my example and there's no way to suppress them:
https://godbolt.org/z/PbnM8cfc1

[Bug c/66918] Disable "inline function declared but never defined" warning

2021-10-19 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

Eric Gallager  changed:

   What|Removed |Added

 Blocks||44209
 CC||egallager at gcc dot gnu.org

--- Comment #10 from Eric Gallager  ---
This is an instance of bug 44209


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44209
[Bug 44209] [meta-bug] Some warnings are not linked to diagnostics options

[Bug c/66918] Disable "inline function declared but never defined" warning

2020-11-04 Thread federico.kircheis at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

Federico Kircheis  changed:

   What|Removed |Added

 CC||federico.kircheis at gmail dot 
com

--- Comment #9 from Federico Kircheis  ---
Hello,

I stumbled on this warning too, and would really like to disable it.

Having a defined but not implemented function can help to detect errors at
compile time since c++11, for example consider



#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wundefined-inline"
constexpr int stop_compilation();
#pragma GCC diagnostic pop

constexpr int foo(int i){
   return is_not_valid(i) ? stop_compilation() : i+42;
}



thanks to `stop_compilation()`, we force the user to use foo in a constexpr
context, and we can validate the parameter.

The code works as intended with GCC, MSVC and clang(!).


Rewriting the code as


constexpr int foo(int i){
   return is_not_valid(i) ? throw 42 : i+42;
}


makes `foo` usable in a non-constexpr context.

In clang it is possible to ignore the warning with "-Wundefined-inline", maybe
GCC could adopt the same switch?

[Bug c/66918] Disable "inline function declared but never defined" warning

2019-02-19 Thread pskocik at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

--- Comment #8 from pskocik at gmail dot com ---
I'd also very much welcome a way to silence this (like with
-Wno-undefined-inline on clang).

My reason for wanting it is I'd like to prototype a non-static inline function
in one header (a fast-to-include header), define it in another (a
slower-to-parse header that might not always be needed), and have both headers
includable in the same translation unit.

Dummy example:

/*first.h*/
inline void f(void);

/*second.h*/
//#include "first.h"
inline void f(void){}

Unfortunately, if only the first header is included, gcc's generating this
unsilencable warning unless I drop the `inline` from the prototype, but if I do
and if I then also include the second header with the definition, then the
prototype without the inline will turn into an unwanted instantiation and
linker errors down the road.

[Bug c/66918] Disable "inline function declared but never defined" warning

2019-02-19 Thread pskocik at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

pskocik at gmail dot com changed:

   What|Removed |Added

 CC||pskocik at gmail dot com

--- Comment #7 from pskocik at gmail dot com ---
I'd also very much welcome a way to silence this (like with
-Wno-undefined-inline on clang).

My reason for wanting it is I'd like to prototype a non-static inline function
in one header (a fast-to-include header), define it in another (a
slower-to-parse header that might not always be needed), and have both headers
includable in the same translation unit.

Dummy example:

/*first.h*/
inline void f(void);

/*second.h*/
//#include "first.h"
inline void f(void){}

Unfortunately, if only the first header is included, gcc's generating this
unsilencable warning unless I drop the `inline` from the prototype, but if I do
and if I then also include the second header with the definition, then the
prototype without the inline will turn into an unwanted instantiation and
linker errors down the road.

[Bug c/66918] Disable inline function declared but never defined warning

2015-07-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #5 from Marek Polacek mpolacek at gcc dot gnu.org ---
I don't think the C++ FE has this warning; it's about C99 inlines.

I think this should not be a part of -Wunused-function, maybe just a part of
-Wpedantic warning.


[Bug c/66918] Disable inline function declared but never defined warning

2015-07-20 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

--- Comment #6 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
(In reply to Marek Polacek from comment #5)
 I don't think the C++ FE has this warning; it's about C99 inlines.

If not, it has a very similar warning:

/home/manuel/test.cc:1:13: warning: inline function ‘void test()’ used but
never defined
 inline void test(void);
 ^

[Bug c/66918] Disable inline function declared but never defined warning

2015-07-19 Thread eugene.zelenko at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

--- Comment #4 from Eugene Zelenko eugene.zelenko at gmail dot com ---
(In reply to Manuel López-Ibáñez from comment #3)
 Does Clang have an option for this? GCC could use the same name.
 
 (The same warning exists in the C++ FE, thus it should be controlled by the
 same option).

I tried small example with Clang 3.7 https://gcc.godbolt.org and it looks like
it doesn't have such warning (I used -Weverything -std=C++11 and C++14).

GCC already has -Wunused-function and it seems reasonable to extend it to
inline functions.

[Bug c/66918] Disable inline function declared but never defined warning

2015-07-18 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

--- Comment #1 from Andrew Pinski pinskia at gcc dot gnu.org ---
Could you explain why you don't want to have this warning really.  This warning
is telling you that the inline function is not defined  just like static
functions.


[Bug c/66918] Disable inline function declared but never defined warning

2015-07-18 Thread eugene.zelenko at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

--- Comment #2 from Eugene Zelenko eugene.zelenko at gmail dot com ---
(In reply to Andrew Pinski from comment #1)
 Could you explain why you don't want to have this warning really.  This
 warning is telling you that the inline function is not defined  just like
 static functions.

I want this warning, but I need individual switch to turn it on/off and forcing
it to be warning/error. Just as any other warning.


[Bug c/66918] Disable inline function declared but never defined warning

2015-07-18 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66918

Manuel López-Ibáñez manu at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-07-18
 CC||manu at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #3 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
Does Clang have an option for this? GCC could use the same name.

(The same warning exists in the C++ FE, thus it should be controlled by the
same option).