COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 12-22-2017, 07:30 PM   #1
MSK
Human being with feelings
 
Join Date: Jan 2017
Posts: 42
Default Custom Build Errors

Hey Everyone!

This isn't really specific to WDL, but I thought I'd ask here since a lot of you guys should similar setups.

Does anyone know how to add a custom build error in Xcode? Basically what I'd like to do is have XCode throw a build error whenever there's a case in a switch statement that doesn't have a break. Since I definitely see the potential use of having fall-through cases without breaks, ideally I could add a special comment to those cases to override the error.

It's a pretty minor problem, but I've had a few debugging headaches due to it, and if what I'm imagining is easy to implement I think it'd be worth it.

I'm using Xcode 8.2.1 on macOS 10.12, and using Youlean's IPlug branch.

Cheers!
Max
MSK is offline   Reply With Quote
Old 12-22-2017, 08:49 PM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 1,943
Default

clang has a warning for this that can be enabled with the -Wimplicit-fallthrough option (only if using at least C++11). It can be turned into an error using -Werror=implicit-fallthrough.

https://clang.llvm.org/docs/Attribut...ng-fallthrough
http://en.cppreference.com/w/cpp/language/attributes



(GCC 7's implicit-fallthrough warning supports comments in addition to attributes as a way to specify fall-through is intended. https://developers.redhat.com/blog/2...ough-in-gcc-7/)

Last edited by cfillion; 12-22-2017 at 09:45 PM.
cfillion is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:37 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.