NSAssert and noescape?

Aaron Hillegass <[email protected]> Mon, 5 Feb 2018 13:47:28 -0500
Newsgroups gmane.comp.lib.gnustep.user
Message-ID <[email protected]>
--===============0480990190723517219==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_B3C18973-874E-4BF6-A9B4-E078581D840E"


--Apple-Mail=_B3C18973-874E-4BF6-A9B4-E078581D840E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hi,

I=E2=80=99m porting the FMDB library to run on GNUstep on Linux:
	https://github.com/ccgus/fmdb

I=E2=80=99m getting errors with the vargs on NSAssert:
FMDatabase.m:1495:36: error: too many arguments provided to =
function-like macro invocation
            NSAssert(false, @"%@", [self lastErrorMessage]);
                                   ^
/usr/local/include/Foundation/NSException.h:475:9: note: macro =
'NSAssert' defined here
#define NSAssert(condition, desc)                     =20

I=E2=80=99m also getting some warnings on noescape:
./FMDatabasePool.h:199:36: warning: unknown attribute 'noescape' ignored =
[-Wunknown-attributes]
- (void)inDatabase:(__attribute__((noescape)) void (^)(FMDatabase =
*db))block;

I=E2=80=99d appreciate any help I can get.

- Aaron

P.S.

Trivia for other who will come after me: I had to install libbsd and =
libdispatch. As a dumb work-around, I also defined some empty macros:

#ifdef __linux__
    #define SInt32 int32_t
    #define NS_SWIFT_NAME(the_name)
    #define __deprecated_msg(the_message)
#endif

Here=E2=80=99s how I=E2=80=99m building it:
clang -x objective-c -fconstant-string-class=3DNSConstantString -fPIC =
-fobjc-nonfragile-abi -fblocks  -I/usr/local/include/ -c FMDatabase.m -o =
FMDatabase.o

Clang details:
$ clang --version
clang version 4.0.1-6 (tags/RELEASE_401/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin





--Apple-Mail=_B3C18973-874E-4BF6-A9B4-E078581D840E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><div =
class=3D"">Hi,</div><div class=3D""><br class=3D""></div>I=E2=80=99m =
porting the FMDB library to run on GNUstep on Linux:<div class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><a =
href=3D"https://github.com/ccgus/fmdb" =
class=3D"">https://github.com/ccgus/fmdb</a></div><div class=3D""><br =
class=3D""></div><div class=3D"">I=E2=80=99m getting errors with the =
vargs on NSAssert:<br class=3D""><font face=3D"Courier New" =
class=3D"">FMDatabase.m:1495:36: error: too many arguments provided to =
function-like macro invocation<br class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; NSAssert(false, @"%@", [self lastErrorMessage]);<br =
class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;^<br class=3D"">/usr/local/include/Foundation/NSException.h:475:9: =
note: macro 'NSAssert' defined here<br class=3D"">#define =
NSAssert(condition, desc)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br class=3D""></font><br =
class=3D"">I=E2=80=99m also getting some warnings on noescape:<br =
class=3D""><font face=3D"Courier New" =
class=3D"">./FMDatabasePool.h:199:36: warning: unknown attribute =
'noescape' ignored [-Wunknown-attributes]<br class=3D"">- =
(void)inDatabase:(__attribute__((noescape)) void (^)(FMDatabase =
*db))block;</font></div><div class=3D""><br class=3D""></div><div =
class=3D"">I=E2=80=99d appreciate any help I can get.</div><div =
class=3D""><br class=3D""></div><div class=3D"">- Aaron</div><div =
class=3D""><br class=3D""></div><div class=3D"">P.S.</div><div =
class=3D""><br class=3D""></div><div class=3D"">Trivia for other who =
will come after me: I had to install libbsd and libdispatch. As a dumb =
work-around, I also defined some empty macros:</div><div class=3D""><br =
class=3D""></div><div class=3D""><font face=3D"Courier New" =
class=3D"">#ifdef __linux__<br class=3D"">&nbsp; &nbsp; #define SInt32 =
int32_t<br class=3D"">&nbsp; &nbsp; #define NS_SWIFT_NAME(the_name)<br =
class=3D"">&nbsp; &nbsp; #define __deprecated_msg(the_message)<br =
class=3D"">#endif</font></div><div class=3D""><br class=3D""></div><div =
class=3D"">Here=E2=80=99s how I=E2=80=99m building it:</div><div =
class=3D""><font face=3D"Courier New" class=3D"">clang -x objective-c =
-fconstant-string-class=3DNSConstantString -fPIC -fobjc-nonfragile-abi =
-fblocks &nbsp;-I/usr/local/include/ -c FMDatabase.m -o =
FMDatabase.o</font></div><div class=3D""><br class=3D""></div><div =
class=3D"">Clang details:</div><div class=3D""><font face=3D"Courier =
New" class=3D"">$ clang --version<br class=3D"">clang version 4.0.1-6 =
(tags/RELEASE_401/final)<br class=3D"">Target: x86_64-pc-linux-gnu<br =
class=3D"">Thread model: posix<br class=3D"">InstalledDir: /usr/bin<br =
class=3D""></font><br class=3D""></div><div class=3D""><br =
class=3D""></div><div class=3D""><br class=3D""></div><div class=3D""><br =
class=3D""></div></body></html>=

--Apple-Mail=_B3C18973-874E-4BF6-A9B4-E078581D840E--


--===============0480990190723517219==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Help-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-gnustep

--===============0480990190723517219==--