Skip to content

Instantly share code, notes, and snippets.

function get_foo_args
# Here are our possible comma-separated values.
set choices happy green dragon
# Get what the user has typed so far as the token under the cursor.
# For example, this might be "--stuff=abc,def"
set token (commandline -ct)
# We don't know if the user used a space or = separator.
# Split about =, and take the last part.
#include <mutex>
static void hello() {}
int main(void)
{
std::once_flag just_once{};
std::call_once(just_once, hello);
return 0;
}
extern "C" int pthread_once(int *, void());
int a(int *c, void __func()) { return pthread_once(c, __func); }
namespace b {
struct A {
int e;
};
extern "C" void __once_proxy();
template < typename f > void d(A &c, f ) { a(&c.e, __once_proxy); }
}
void h();
extern "C" void pthread_once(int *, void());
namespace std
{
extern __thread void (*__once_call)();
extern "C" void __once_proxy();
}; // namespace std
static void noop() {}
using voidfunc = void (*)();
#include <mutex>
static void hello() {}
int main(void)
{
std::once_flag just_once{};
std::call_once(just_once, hello);
return 0;
}
#include <assert.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <spawn.h>
#include <sys/wait.h>
static void show_sigmask(const char *when) {
sigset_t sigs;
sigemptyset(&sigs);
int err = sigprocmask(SIG_SETMASK, 0, &sigs);
@ridiculousfish
ridiculousfish / spawni.c
Created June 6, 2020 22:13
glibc/glibc-2.29/sysdeps/unix/sysv/linux/spawni.c
/* POSIX spawn interface. Linux version.
Copyright (C) 2016-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// RUN: %hermes -target=HBC -O %s | %FileCheck --match-full-lines %s
// RUN: %hermes -target=HBC -O -emit-binary -out %t.hbc %s && %hermes %t.hbc | %FileCheck --match-full-lines %s
"use strict";
#include <unistd.h>
"__DARWIN_C_LEVEL" = __DARWIN_C_LEVEL