fix noDecl => nodecl (#16760)

* fix noDecl => nodecl

* address comment

* disable flaky tests/stdlib/thttpclient.nim on freebsd
This commit is contained in:
Timothee Cour 2021-01-20 02:08:42 -08:00 • committed by GitHub
commit 14730d9d64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View file

@ -6692,16 +6692,16 @@ in C/C++).
**Note**: This pragma will not exist for the LLVM backend. **Note**: This pragma will not exist for the LLVM backend.
NoDecl pragma nodecl pragma
------------- -------------
The ``noDecl`` pragma can be applied to almost any symbol (variable, proc, The `nodecl` pragma can be applied to almost any symbol (variable, proc,
type, etc.) and is sometimes useful for interoperability with C: type, etc.) and is sometimes useful for interoperability with C:
It tells Nim that it should not generate a declaration for the symbol in It tells Nim that it should not generate a declaration for the symbol in
the C code. For example: the C code. For example:
.. code-block:: Nim .. code-block:: Nim
var var
EACCES {.importc, noDecl.}: cint # pretend EACCES was a variable, as EACCES {.importc, nodecl.}: cint # pretend EACCES was a variable, as
# Nim does not know its value # Nim does not know its value
However, the ``header`` pragma is often the better alternative. However, the ``header`` pragma is often the better alternative.
@ -6711,7 +6711,7 @@ However, the ``header`` pragma is often the better alternative.
Header pragma Header pragma
------------- -------------
The ``header`` pragma is very similar to the ``noDecl`` pragma: It can be The `header` pragma is very similar to the `nodecl` pragma: It can be
applied to almost any symbol and specifies that it should not be declared applied to almost any symbol and specifies that it should not be declared
and instead, the generated code should contain an ``#include``: and instead, the generated code should contain an ``#include``:

View file

@ -22,7 +22,7 @@ asm """
function print (text) { console.log (text); } function print (text) { console.log (text); }
""" """
proc consoleprint (str:cstring): void {.importc: "print", noDecl.} proc consoleprint (str:cstring): void {.importc: "print", nodecl.}
proc print* (a: varargs[string, `$`]) = consoleprint "$1: $2" % [consolePrefix, join(a, " ")] proc print* (a: varargs[string, `$`]) = consoleprint "$1: $2" % [consolePrefix, join(a, " ")]
type CallbackProc {.importc.} = proc () : cstring type CallbackProc {.importc.} = proc () : cstring

View file

@ -1,6 +1,7 @@
discard """ discard """
cmd: "nim c --threads:on -d:ssl $file" cmd: "nim c --threads:on -d:ssl $file"
disabled: "openbsd" disabled: "openbsd"
disabled: "freebsd"
disabled: "windows" disabled: "windows"
""" """