<commit_before>/* --------------------------------------------------------------------------
 *
 * (c) The GHC Team, 1992-2004
 *
 * mkDerivedConstants.c
 *
 * Basically this is a C program that extracts information from the C
 * declarations in the header files (primarily struct field offsets)
 * and generates a header file that can be #included into non-C source
 * containing this information.
 *
 * ------------------------------------------------------------------------*/

#define IN_STG_CODE 0

/*
 * We need offsets of profiled things... better be careful that this
 * doesn't affect the offsets of anything else.
 */
#define PROFILING
#define THREADED_RTS

#include "Rts.h"

#include "Stable.h"
#include "Capability.h"

#include <stdio.h>

#define str(a,b) #a "_" #b

#define OFFSET(s_type, field) ((size_t)&(((s_type*)0)->field))

#ifdef mingw32_HOST_OS
#define SIZET_FMT "d"
#else
#define SIZET_FMT "zd"
#endif

#if defined(GEN_HASKELL)
#define def_offset(str, offset)                          \
    printf("oFFSET_" str " :: Int\n");                   \
    printf("oFFSET_" str " = %" SIZET_FMT "\n", offset);
#else
#define def_offset(str, offset) \
    printf("#define OFFSET_" str " %" SIZET_FMT "\n", offset);
#endif

#if defined(GEN_HASKELL)
#define ctype(type) /* nothing */
#else
#define ctype(type) \
    printf("#define SIZEOF_" #type " %lu\n", (unsigned long)sizeof(type));
#endif

#if defined(GEN_HASKELL)
#define field_type_(str, s_type, field) /* nothing */
#define field_type_gcptr_(str, s_type, field) /* nothing */
#else
/* Defining REP_x to be b32 etc
   These are both the C-- types used in a load
      e.g.  b32[addr]
   and the names of the CmmTypes in the compiler
      b32 :: CmmType
*/
#define field_type_(str, s_type, field) \
    printf("#define REP_" str " b"); \
    printf("%lu\n", (unsigned long)sizeof (__typeof__(((((s_type*)0)->field)))) * 8);
#define field_type_gcptr_(str, s_type, field) \
    printf("#define REP_" str " gcptr\n");
#endif

#define field_type(s_type, field) \
    field_type_(str(s_type,field),s_type,field);

#define field_offset_(str, s_type, field) \<commit_msg>avoid using non-standard %zd format specifier (#3804)<commit_after>/* --------------------------------------------------------------------------
 *
 * (c) The GHC Team, 1992-2004
 *
 * mkDerivedConstants.c
 *
 * Basically this is a C program that extracts information from the C
 * declarations in the header files (primarily struct field offsets)
 * and generates a header file that can be #included into non-C source
 * containing this information.
 *
 * ------------------------------------------------------------------------*/

#define IN_STG_CODE 0

/*
 * We need offsets of profiled things... better be careful that this
 * doesn't affect the offsets of anything else.
 */
#define PROFILING
#define THREADED_RTS

#include "Rts.h"

#include "Stable.h"
#include "Capability.h"

#include <stdio.h>

#define str(a,b) #a "_" #b

#define OFFSET(s_type, field) ((size_t)&(((s_type*)0)->field))

#if defined(GEN_HASKELL)
#define def_offset(str, offset)                          \
    printf("oFFSET_" str " :: Int\n");                   \
    printf("oFFSET_" str " = %lu\n", (unsigned long)offset);
#else
#define def_offset(str, offset) \
    printf("#define OFFSET_" str " %lu\n", (unsigned long)offset);
#endif

#if defined(GEN_HASKELL)
#define ctype(type) /* nothing */
#else
#define ctype(type) \
    printf("#define SIZEOF_" #type " %lu\n", (unsigned long)sizeof(type));
#endif

#if defined(GEN_HASKELL)
#define field_type_(str, s_type, field) /* nothing */
#define field_type_gcptr_(str, s_type, field) /* nothing */
#else
/* Defining REP_x to be b32 etc
   These are both the C-- types used in a load
      e.g.  b32[addr]
   and the names of the CmmTypes in the compiler
      b32 :: CmmType
*/
#define field_type_(str, s_type, field) \
    printf("#define REP_" str " b"); \
    printf("%lu\n", (unsigned long)sizeof (__typeof__(((((s_type*)0)->field)))) * 8);
#define field_type_gcptr_(str, s_type, field) \
    printf("#define REP_" str " gcptr\n");
#endif

#define field_type(s_type, field) \
    field_type_(str(s_type,field),s_type,field);

#define field_offset_(str, s_type, field) \
{'fraction_non_alphanumeric': 0.20378250591016547, 'fraction_numerical': 0.009929078014184398, 'mean_word_length': 2.7743086529884033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '4985177', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1376, 'n_words': 406}