gallows humor
Humor that aims to make grim subjects, like death, funny or comical. (A "gallows" is the wooden frame from which criminals were traditionally hanged.) A: "Why would he say a morbid thing like that?" B: "Oh, that's just how Uncle Ned is—he's prone to gallows humor."
gallows humor
Grim ironical humor about a serious subject. The term dates from the late 1800s and alludes to joking about being taken to the gallows and hanged. When President Barack Obama was asked why he laughed when talking about the bad state of the world economy, he replied, with a laugh, “There’s gotta be a little gallows humor to get you through the day” (Sixty Minutes, March 22, 2009).