Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/lib_id_delete.c
| Show First 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | if (do_tagged_deletion) { | ||||
| * of other deleted IDs. | * of other deleted IDs. | ||||
| * This gives tremendous speed-up when deleting a large amount of IDs from a Main | * This gives tremendous speed-up when deleting a large amount of IDs from a Main | ||||
| * containing thousands of those. | * containing thousands of those. | ||||
| * This also means that we have to be very careful here, as we by-pass many 'common' | * This also means that we have to be very careful here, as we by-pass many 'common' | ||||
| * processing, hence risking to 'corrupt' at least user counts, if not IDs themselves. */ | * processing, hence risking to 'corrupt' at least user counts, if not IDs themselves. */ | ||||
| bool keep_looping = true; | bool keep_looping = true; | ||||
| while (keep_looping) { | while (keep_looping) { | ||||
| ID *id, *id_next; | ID *id, *id_next; | ||||
| ID *last_remapped_id = tagged_deleted_ids.last; | /* Marked volatile to avoid a macOS Clang optimization bug. See T81077. | ||||
mont29: This requires a comment stating that it is a temporary work around to address a bug in OSX… | |||||
Done Inline ActionsShould I add a preprocessor directive __APPLE__? ankitm: Should I add a preprocessor directive `__APPLE__`? | |||||
Done Inline Actionsam not sure it would be worth it, this should not have impact on other platforms? mont29: am not sure it would be worth it, this should not have impact on other platforms? | |||||
Done Inline ActionsI have a hard time believing that this is apple specific, afaik Apple doesn't do such in-depth changes to their version of Clang. With some configurations or versions of Clang the error may still happen on Linux. Severin: I have a hard time believing that this is apple specific, afaik Apple doesn't do such in-depth… | |||||
Done Inline Actions__APPLE__ would've covered macOS clang from both LLVM and Apple. ankitm: `__APPLE__` would've covered macOS clang from both LLVM and Apple.
I thought of it just to… | |||||
| * #last_remapped_id.next is assumed to be NULL by optimizer which is wrong. */ | |||||
| volatile ID *last_remapped_id = tagged_deleted_ids.last; | |||||
| keep_looping = false; | keep_looping = false; | ||||
| /* First tag and remove from Main all datablocks directly from target lib. | /* First tag and remove from Main all datablocks directly from target lib. | ||||
| * Note that we go forward here, since we want to check dependencies before users | * Note that we go forward here, since we want to check dependencies before users | ||||
| * (e.g. meshes before objects). Avoids to have to loop twice. */ | * (e.g. meshes before objects). Avoids to have to loop twice. */ | ||||
| for (i = 0; i < base_count; i++) { | for (i = 0; i < base_count; i++) { | ||||
| ListBase *lb = lbarray[i]; | ListBase *lb = lbarray[i]; | ||||
| ▲ Show 20 Lines • Show All 116 Lines • Show Last 20 Lines | |||||
This requires a comment stating that it is a temporary work around to address a bug in OSX Clang compiler optimizer.
There is no reasons for this variable to be volatile in itself otherwise...