How to avoid warning of auxiliary functions? "xxx defined but not used"

I learned from this post here to create helper functions in the namespace. 'Helpers' in C ++

//stringhelper.hpp
namespace utility{
static std::string intToString(int integer)
{
    std::stringstream sstream;
    sstream << integer;
    return sstream.str();
}
static void toLowerCase(std::string& y)
{
    std::transform(y.begin(), y.end(), y.begin(), (int(*)(int))tolower);
}
}

I include this header, but I received the following warning

'void utility::toLowerCase(std::string&)' defined but not used  

Yes. I used intToString (int integer), but not toLowerCase (std :: string &). I do not want to see these warnings or divide one helper function into a header.

Can anyone suggest a good solution? Should I just turn off the warning? Thanks you

+3
source share
1 answer

You have the option to disable this warning:

-Wno-unused-function

Depending on the function of the GCC, you can determine:

void whatever () __attribute__ ((unused));

void whatever () {
    stuff;
}

GCC , , , .

. .
+3

All Articles