Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix this statement may fall through [-Werror=implicit-fallthrough=]?

Tags:

c++

c

cmake

What does

this statement may fall through [-Werror=implicit-fallthrough=]

mean ?

I getting this error while compiling at statement like this:

switch(eT)
    {
    case SEL_CRIT:
        {
            TYPE1* psSel;
            iRetVal = dbseq(enB->m_ps,
                NULL, NULL, &esM, NULL, ESEC);
            while (iRetVal == 0)
            {
                if(psEnterprise)
                {
                    bool iFound = false;
                    for (i = 0; i< psME->m_pslave[0].m_uc; i++)
                    {
                        ENT node1;
                        sEOS = psME>m_pslave[0].m_pslavecnt[i];

                    }
                    if (iFound && (psME->m_NOTOVERLOADED == false))
                    {
                        return psME;
                    }
                }
            }
            psSel = (M_EN*)pCrit;
            LOG_INFO(FAIL_TO_LOAD, psME->m_ONG, psME->EN);
            int_Enterprise = NULL;
        }

at

int_Enterprise = NULL;

where

int_Enterprise is some structure pointer.

How can I fix this?

like image 695
Astra Uvarova - Saturn's star Avatar asked Nov 15 '25 19:11

Astra Uvarova - Saturn's star


1 Answers

You have no break; at the end of your case: so execution will fall through into the next case. Add a break statement to prevent fall-through if that's what you want or add a [[fallthrough]] attribute if fallthrough is intended.

like image 131
Jesper Juhl Avatar answered Nov 18 '25 09:11

Jesper Juhl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!