From 970fc43aa5b6dc7cbc2fd0a348ab0e77b3fa5a90 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Tue, 1 Sep 2009 13:55:14 +0000 Subject: [PATCH] * fixed support for forward-declared objcprotocols + test (also for warning about missing constructor) git-svn-id: branches/objc@13633 - --- .gitattributes | 1 + compiler/pdecl.pas | 3 ++- tests/test/tobjc14.pp | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/test/tobjc14.pp diff --git a/.gitattributes b/.gitattributes index cf9ecf19da..99121f338a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8221,6 +8221,7 @@ tests/test/tobjc10.pp svneol=native#text/plain tests/test/tobjc11.pp svneol=native#text/plain tests/test/tobjc12.pp svneol=native#text/plain tests/test/tobjc13.pp svneol=native#text/plain +tests/test/tobjc14.pp svneol=native#text/plain tests/test/tobjc2.pp svneol=native#text/plain tests/test/tobjc3.pp svneol=native#text/plain tests/test/tobjc4.pp svneol=native#text/plain diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index 6bf1b28757..b90178e223 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -389,7 +389,8 @@ implementation if ((token=_CLASS) or (token=_INTERFACE) or (token=_DISPINTERFACE) or - (token=_OBJCCLASS)) and + (token=_OBJCCLASS) or + (token=_OBJCPROTOCOL)) and (assigned(ttypesym(sym).typedef)) and is_class_or_interface_or_dispinterface_or_objc(ttypesym(sym).typedef) and (oo_is_forward in tobjectdef(ttypesym(sym).typedef).objectoptions) then diff --git a/tests/test/tobjc14.pp b/tests/test/tobjc14.pp new file mode 100644 index 0000000000..9427958585 --- /dev/null +++ b/tests/test/tobjc14.pp @@ -0,0 +1,21 @@ +{ %OPT=-Sew -vw } +{ %norun } + +{$mode objfpc} +{$modeswitch objectivec1} + +{ test forward-declared objcprotocol } +{ make sure no warning is given about the absense of any constructors } + +type + ta = objcprotocol; + + tb = objcclass + a: ta; + end; external name 'NSObject'; + + ta = objcprotocol + end; external name 'NSObject'; + +begin +end.