[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git] / main.c
blobcbb294ba724999aff3fe0f939a0c99fff0abcb8d
1 /**********************************************************************
3 main.c -
5 $Author$
6 created at: Fri Aug 19 13:19:58 JST 1994
8 Copyright (C) 1993-2007 Yukihiro Matsumoto
10 **********************************************************************/
12 /*!
13 * \mainpage Developers' documentation for Ruby
15 * This documentation is produced by applying Doxygen to
16 * <a href="https://github.com/ruby/ruby">Ruby's source code</a>.
17 * It is still under construction (and even not well-maintained).
18 * If you are familiar with Ruby's source code, please improve the doc.
20 #undef RUBY_EXPORT
21 #include "ruby.h"
22 #include "vm_debug.h"
23 #include "internal/sanitizers.h"
24 #ifdef HAVE_LOCALE_H
25 #include <locale.h>
26 #endif
28 #if defined RUBY_DEVEL && !defined RUBY_DEBUG_ENV
29 # define RUBY_DEBUG_ENV 1
30 #endif
31 #if defined RUBY_DEBUG_ENV && !RUBY_DEBUG_ENV
32 # undef RUBY_DEBUG_ENV
33 #endif
35 static int
36 rb_main(int argc, char **argv)
38 RUBY_INIT_STACK;
39 ruby_init();
40 return ruby_run_node(ruby_options(argc, argv));
43 #if defined(__wasm__) && !defined(__EMSCRIPTEN__)
44 int rb_wasm_rt_start(int (main)(int argc, char **argv), int argc, char **argv);
45 #define rb_main(argc, argv) rb_wasm_rt_start(rb_main, argc, argv)
46 #endif
48 int
49 main(int argc, char **argv)
51 #if defined(RUBY_DEBUG_ENV) || USE_RUBY_DEBUG_LOG
52 ruby_set_debug_option(getenv("RUBY_DEBUG"));
53 #endif
54 #ifdef HAVE_LOCALE_H
55 setlocale(LC_CTYPE, "");
56 #endif
58 ruby_sysinit(&argc, &argv);
59 return rb_main(argc, argv);
62 #ifdef RUBY_ASAN_ENABLED
63 /* Compile in the ASAN options Ruby needs, rather than relying on environment variables, so
64 * that even tests which fork ruby with a clean environment will run ASAN with the right
65 * settings */
66 const char *
67 __asan_default_options(void)
69 return "use_sigaltstack=0:detect_leaks=0";
71 #endif