<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Poisoning Objective-C methods"
href="http://llvm.org/bugs/show_bug.cgi?id=15931">15931</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Poisoning Objective-C methods
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>iamleeg@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Summary: Clang inherits the "poison" pragma from GCC. Unfortunately it doesn't
support poisoning Objective-C selectors very well.
Steps to reproduce: compile this code.
#import <Foundation/Foundation.h>
#pragma GCC poison initWithCString:
int main(int argc, char *argv[]) {
@autoreleasepool {
NSString *foo = [[NSString alloc] initWithCString:"foo"
encoding:NSUTF8StringEncoding];
NSLog(@"%@", foo);
}
}
Expected results: that should work. I've poisoned "initWithCString:" but used
"initWithCString:encoding:".
Actual results: two errors are emitted.
Untitled.m:2:35: error: can only poison identifier tokens
#pragma GCC poison initWithCString:
^
Untitled.m:6:37: error: attempt to use a poisoned identifier
NSString *foo = [[NSString alloc] initWithCString:"foo"
encoding:NSUTF8StringEncoding];
^
2 errors generated.
Notes: whether it's a separate pragma or not, I would like to enforce
Objective-C code guidelines by poisoning specific selectors. That shouldn't
poison other selectors that happen to contain my poisoned selectors in
substrings.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>