Page MenuHome

ATTR_FALLTHROUGH duplicate definition warnings
AbandonedPublic

Authored by Roel Koster (kostex) on Nov 19 2018, 9:37 AM.

Details

Summary

When compiling blender (2.8) a lot of warnings are generated that ATTR_FALLTHROUGH has already been assigned.
This patch (hopefully done right) solves this

Thanks for looking into it.

Diff Detail

Repository
rB Blender

Event Timeline

I noticed this too, and was about to submit an issue. I think you can use #ifndef instead of #if !defined(. I would also probably put it on both definitions since GCC7+ would still produce warnings. The cleanest way would be to simply wrap the whole if else with an ifndef.

Brecht Van Lommel (brecht) requested changes to this revision.Dec 21 2018, 4:43 PM

It shouldn't be defined multiple times in the first place. If we check if it has been defined before, we don't know if the macro has been defined correctly.

I've never seen this warning though, it would help to see the compiler warning log to understand why it happens.

This revision now requires changes to proceed.Dec 21 2018, 4:43 PM

It shouldn't be defined multiple times in the first place. If we check if it has been defined before, we don't know if the macro has been defined correctly.

I've never seen this warning though, it would help to see the compiler warning log to understand why it happens.

They are really not all that hard to miss, all platforms have the warning:

on mac, starts on line 735
on windows starts on line 4634
on linux starts on line 3306

Seems this is difficult to avoid otherwise. Slightly different fix committed now.

That patch only protects one of the places, not both - I don't think the includes are ordered in such a way where that stops all the warnings. I still get lots of warnings for when the Cycles header in included first.