It seems that on Alpine Linux (Edge), the LLVM_LIBRARY_DIRS cmake
variable doesn't look in /usr/lib, which is where the relevant files are
on Alpine.
Only do this for !WIN32 systems.
* add std::net::url for parsing/generating URLs
* Move String.index_of_chars into std
* Fix param contract
* Idiomatic type naming, Allman formatting, slicing, document functions
* Use String.tokenize
* Don't return str_view() from freed dstring
* Change indentation to tabs
* Variable casing according to guidlelines
* Updated API and added line to the releasenotes.
---------
Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
* enhance default hashing strategy for basic types
* fix
* `$defined` in a global scope should accept testing normal macros.
---------
Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
If the timeout to net::poll() is -1, poll() will block until a requested
event occurs. However, in the poll() function, the Duration timeout is
converted to milliseconds (Duration is in microseconds). The conversion
involves integer arithmetics which results in a zero timeout (= -1 /
1000), i.e. poll() will return immediately and the following accept will
fail.
To fix this, only convert to milliseconds if timeout paramter is
non-negative.
Example to reproduce the error:
```
module echo;
import std::io, std::net;
fn void main()
{
TcpServerSocket server = tcp::listen("localhost", 6969, 69, REUSEADDR)!!;
server.sock.set_non_blocking(true)!!;
Poll[*] polls = {{ .socket = server.sock, .events = net::SUBSCRIBE_READ }};
if (catch net::poll(polls[..], net::POLL_FOREVER)) io::printn("poll error");
TcpSocket client = tcp::accept(&server)!!;
io::printn("OK");
}
```
Poll() will return immediately and the following tcp::accept() will fail
with an "ACCEPT_FAILED" error.
Reported-by: Alexey Kutepov <reximkut@gmail.com>
* Fix UX of the `c3c project add-target` subcommand
- Fix segfault on `project.json` containing empty map `{}`
- Enable `add-target` to operate on non-existing project files
- Extend `add-target` syntax to accept source through CLI args
This enables the following workflow without friction and needless
crashes:
```console
$ cat > main.c3 <<END
import std::io;
fn void main() {
io::printfn("Hello, World");
}
END
$ c3c project add-target main executable main.c3
$ c3c run
```
* Fix read_project() call in fetch_project()
* Keep the style of curlies consistent
* Fix JSON formatting in parse command, strings now "JSON-legal"
* Clean up
* Implemented JSON for CONST_BYTES
* Handle empty byte string, slightly more concise
* of course msvc is the *only* compiler that complains about this