Commit 0832f814 authored by j4cbo's avatar j4cbo

Merge pull request #17 from skabbes/fix/assert_arc

static_assert that ARC is enabled
parents f6e2a81d 28a34a25
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation TXSItemList @implementation TXSItemList
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <exception> #include <exception>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation TXSSortItemsCppProxy @implementation TXSSortItemsCppProxy
- (id)initWithCpp:(const std::shared_ptr<::textsort::SortItems> &)cppRef - (id)initWithCpp:(const std::shared_ptr<::textsort::SortItems> &)cppRef
......
...@@ -99,6 +99,8 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) { ...@@ -99,6 +99,8 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
}) })
writeObjcFile(enumTranslatorName(ident), origin, refs.body, w => { writeObjcFile(enumTranslatorName(ident), origin, refs.body, w => {
w.wl(s"static_assert(__has_feature(objc_arc), " + q("Djinni requires ARC to be enabled for this file") + ");" )
w.wl
w.wl(s"@implementation " + self + "Translator") w.wl(s"@implementation " + self + "Translator")
w.wl w.wl
w.wl(s"+ ($self)cpp${name}ToObjc${name}:($cppSelf)${argName}") w.wl(s"+ ($self)cpp${name}ToObjc${name}:($cppSelf)${argName}")
...@@ -251,6 +253,8 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) { ...@@ -251,6 +253,8 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
}) })
writeObjcFile(bodyName(cppExtName), origin, refs.body, w => { writeObjcFile(bodyName(cppExtName), origin, refs.body, w => {
w.wl(s"static_assert(__has_feature(objc_arc), " + q("Djinni requires ARC to be enabled for this file") + ");" )
w.wl
w.wl(s"@implementation $cppExtSelf") w.wl(s"@implementation $cppExtSelf")
w.wl w.wl
w.wl(s"- (id)initWithCpp:(const std::shared_ptr<$cppName> &)cppRef") w.wl(s"- (id)initWithCpp:(const std::shared_ptr<$cppName> &)cppRef")
...@@ -443,6 +447,7 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) { ...@@ -443,6 +447,7 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
writeObjcFile(bodyName(objcName), origin, refs.body, w => { writeObjcFile(bodyName(objcName), origin, refs.body, w => {
if (r.consts.nonEmpty) generateObjcConstants(w, r.consts, noBaseSelf) if (r.consts.nonEmpty) generateObjcConstants(w, r.consts, noBaseSelf)
w.wl(s"static_assert(__has_feature(objc_arc), " + q("Djinni requires ARC to be enabled for this file") + ");" )
w.wl w.wl
w.wl(s"@implementation $self") w.wl(s"@implementation $self")
w.wl w.wl
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBClientReturnedRecord @implementation DBClientReturnedRecord
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include <exception> #include <exception>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBCppExceptionCppProxy @implementation DBCppExceptionCppProxy
- (id)initWithCpp:(const std::shared_ptr<CppException> &)cppRef - (id)initWithCpp:(const std::shared_ptr<CppException> &)cppRef
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBMapListRecord @implementation DBMapListRecord
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBMapRecord @implementation DBMapRecord
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBNestedCollection @implementation DBNestedCollection
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBPrimitiveList @implementation DBPrimitiveList
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBRecordWithDerivings @implementation DBRecordWithDerivings
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBRecordWithNestedDerivings @implementation DBRecordWithNestedDerivings
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBSetRecord @implementation DBSetRecord
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <exception> #include <exception>
#include <utility> #include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBTestHelpersCppProxy @implementation DBTestHelpersCppProxy
- (id)initWithCpp:(const std::shared_ptr<TestHelpers> &)cppRef - (id)initWithCpp:(const std::shared_ptr<TestHelpers> &)cppRef
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment