[Bug c++/81642] New: -Wtype-limits should not trigger for defined numbers
seikusaro at web dot de
gcc-bugzilla@gcc.gnu.org
Tue Aug 1 09:49:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81642
Bug ID: 81642
Summary: -Wtype-limits should not trigger for defined numbers
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: seikusaro at web dot de
Target Milestone: ---
Hi,
My Problem is similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51712
bool foo(const unsigned port)
{
if(port<NUM_IFC) return false;
return true;
}
Our Make will parse a file for every project to get the specific values that
are defines like NUM_IFC.
So if a project has NUM_IFC equal 0 we will get a warning:
warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
But with some projects the number is greater then 0 on those we obviously get
no warning.
I can understand why the compiler gives out a warning and I can suppress it
with a cast to signed.
Yet do you see any way to make gcc see it as intended since it comes from
define.
Best Regards
More information about the Gcc-bugs
mailing list