Commit b176a6ea authored by Jens Gustedt's avatar Jens Gustedt
Browse files

deprecate p99_init.h

parent 36b3c1d4
......@@ -19,7 +19,6 @@
**/
#include "p99_qsort.h"
#include "p99_init.h"
#include "p99_callback.h"
typedef int p00_getopt_process_type(void*, char const*);
......@@ -706,7 +705,26 @@ p00_getopt_diagnostic(char const* p00_err0, char const* p00_err1, char const* p0
p00_err2);
}
P99_MAIN_INTERCEPT(p99_getopt_initialize) {
/**
** @brief Parse the commandline arguments
**
** If you use the getopt facilities you have to launch the parsing of
** the arguments at the beginning of @c main, with preference before
** your program does anything else.
**
** @warning All getopt variable declarations must be visible in the
** same compilation unit that issues the call to this function,
** usually @c main.
**
** This function is <code>static inline</code> because it has to use
** all these variable declarations.
**
** @see P99_GETOPT_DECLARE
** @see P99_GETOPT_SYNOPSIS
** @see P99_GETOPT_CALLBACK
**/
static inline
void p99_getopt_initialize(int * p00_argc, char***p00_argv) {
p00_getopt_allocations_base = P99_CALLOC(void*, *p00_argc);
p00_getopt_allocations = p00_getopt_allocations_base;
atexit(p00_getopt_atexit);
......@@ -826,10 +844,4 @@ P00_REARANGE:
}
}
# if defined(P99_INTERCEPT_MAIN)
# undef main
# define main p99_getopt_initialize
# endif
#endif /* !P99_GETOPT_H_ */
......@@ -25,6 +25,12 @@
** This can emulate gcc's constructor attribute and call init
** functions for variables with static storage duration.
**
** @deprecated This constructor code is too much system dependent and
** too fragile. Don't use it in regular code, this might be removed
** from P99, soon.
**
** The only place that uses this in P99 itself is for threads. There
** is an optional feature to replace main.
**/
/**
......
......@@ -15,8 +15,6 @@
#define P99_THREADS_H 1
#include "p99_try.h"
#include "p99_init.h"
/**
** @addtogroup threads C11 thread emulation on top of POSIX threads
......@@ -907,6 +905,9 @@ void thrd_exit(int p00_res) {
**
** The purpose is to ensure that all threads are C11 threads, and not
** only POSIX threads.
**
** @deprecated The mechanism to launch this is fragile, avoid it if
** possible.
**/
int p99_threads_main(int, char*[]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment