<commit_before>#include <errno.h>
#include <HsFFI.h>
#include <setjmp.h>
#include <stdlib.h>
#include "io_tweag_sparkle_Sparkle.h"

extern HsPtr sparkle_apply(HsPtr a1, HsPtr a2);

// The real main() is provided when linking an executable. But sparkle
// is sometimes loaded dynamically when no main symbol is provided.
// Typically, ghc could load it when building code which uses ANN
// pragmas or template haskell. So we provide a stub that we declare
// "weak". It will be overridden with a real main() when linking an
// executable.
//
// References:
//
// [1] https://linux.die.net/man/1/nm
// [2] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007bweak_007d-function-attribute-3369
int __attribute__((weak)) main(int argc, char *argv[])
{
	fprintf(stderr, "%s: No main() function available.\n", argv[0]);
	return ENOSYS;
}
<commit_msg>Revert "Provide a default stub main()."<commit_after>#include <HsFFI.h>
#include <setjmp.h>
#include "io_tweag_sparkle_Sparkle.h"

extern HsPtr sparkle_apply(HsPtr a1, HsPtr a2);

// main is provided when linking an executable. But sparkle is sometimes
// loaded dynamically when no main symbol is provided. Typically, ghc
// could load it when building code which uses ANN pragmas or template
// haskell.
//
// Because of this we make main a weak symbol. The man page of nm [1]
// says:
//
//   When a weak undefined symbol is linked and the symbol is not
//   defined, the value of the symbol is determined in a system-specific
//   manner without error.
//
// [1] https://linux.die.net/man/1/nm
// [2] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007bweak_007d-function-attribute-3369
extern int main(int argc, char *argv[]) __attribute__((weak));

{'fraction_non_alphanumeric': 0.12408347433728144, 'fraction_numerical': 0.022560631697687534, 'mean_word_length': 4.054131054131054, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '184084', 'n_tokens_mistral': 633, 'n_tokens_neox': 584, 'n_words': 197}