Unfortunately, the flag codes (like many other things) have been hijacked along the way, e.g. when famous entertainers, social movers and shakers, etc. die.
Misuse of flag codes detract from the solemnity due the deceased as provided for in the code.
For the record I greatly respect Senator McCain. I am touched by his final address to the public.