aboutsummaryrefslogtreecommitdiff
path: root/docs/LanguageExtensions.html
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-18 07:07:28 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-18 07:07:28 +0000
commit965acbb321e94e36aa5365126eee46b97745fdbb (patch)
treeb90c16f0aedbfca9146e07251c896cd22d9fd9c6 /docs/LanguageExtensions.html
parentc6c16af963eddc3e9b75b5d2614d069e1162fe27 (diff)
Allow "overloadable" functions in C to be declared as variadic without
any named parameters, e.g., this is accepted in C: void f(...) __attribute__((overloadable)); although this would be rejected: void f(...); To do this, moved the checking of the "ellipsis without any named arguments" condition from the parser into Sema (where it belongs anyway). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64902 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/LanguageExtensions.html')
-rw-r--r--docs/LanguageExtensions.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html
index dfffd2f5d6..67e60dec4d 100644
--- a/docs/LanguageExtensions.html
+++ b/docs/LanguageExtensions.html
@@ -112,6 +112,24 @@ int g(int) { } <i>// error: redeclaration of "g" must also have the "overloadabl
</pre>
</blockquote>
+<p>Functions marked <tt>overloadable</tt> must have
+prototypes. Therefore, the following code is ill-formed:</p>
+
+<blockquote>
+<pre>
+int h() __attribute__((overloadable)); <i>// error: h does not have a prototype</i>
+</pre>
+</blockquote>
+
+<p>However, <tt>overloadable</tt> functions are allowed to use a
+ellipsis even if there are no named parameters (as is permitted in C++). This feature is particularly useful when combined with the <tt>unavailable</tt> attribute:</p>
+
+<blockquote>
+<pre>
+void honeypot(..) __attribute__((overloadable, unavailable)); <i>// calling me is an error</i>
+</pre>
+</blockquote>
+
<p>Functions declared with the <tt>overloadable</tt> attribute have
their names mangled according to the same rules as C++ function
names. For example, the three <tt>tgsin</tt> functions in our