Add more "safe" flags to the package manager

With Xcode 15 came some stronger restrictions around unsafe flags which has broken a lot of my workflows, both personal and professional as we often make use of large Clang targets.

As the original pitch specified, many more flags can safely be added, this was in their futur directions. As the restrictions with unsafe flags have been causing me more pain than anything else in the past year or so, I'd like to revisit that.

Here are some of the flags we often require, I'd like to know if there are actually any risks inherent to them and if not I'd like to gather input to write a pitch adding more safe flags.

  • -fno-objc-arc or its counter-part -fobjc-arc, some of our packages require ARC enabled while others require it disabled. This is a pretty big part of low-level Objective-C frameworks.
  • -fmodules and -fcxx-modules has been needed for @import in Objective-C++ files. I don't personally know enough about them to comment.
  • -x to specify which mode (C, C++, Objective-C, Objective-C++) to compile all clang files as. We have a lot .cpp files with conditional Objective-C++ to be cross-platform and the same with .h headers. Compiling everything as Objective-C++ without requiring renaming files ensures everything works on every platform.
  • -W... so many warnings/errors we may want to enable or disable. With the already in-place conditionals we can configure warnings and errors for Debug/Release and platforms individually

What do you think of this and have you encountered some flags you think should be officially supported?

5 Likes

Including the libruby headers needs -fdeclspec - it would be nice to be able to set this 'safely'.

1 Like