<commit_before>#include <iostream>

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <getopt.h>

#include "codes/uncoded.h"
#include "simulation/simulation.h"

void usage() {
  std::cout << "--l <num>        "
            << "  "
            << "Choose code length l" << std::endl;
  std::cout << "--seed <num>     "
            << "  "
            << "Set seed of the random number generator." << std::endl;
  exit(-1);
}

int main(int argc, char *const argv[]) {
  unsigned long l = 0;
  uint64_t seed = 0;

  while (1) {
    static struct option options[] = {
      { "l", required_argument, nullptr, 'l' },
      { "seed", required_argument, nullptr, 's' },
      { nullptr, 0, nullptr, 0 },
    };

    int option_index = 0;
    int c = getopt_long_only(argc, argv, "", options, &option_index);
    if (c == -1)
      break;

    switch (c) {
    case 'l':
      l = strtoul(optarg, nullptr, 0);
      break;
    case 's':
      seed = strtoull(optarg, nullptr, 0);
      break;
    default:
      std::cerr << "Unkown argument: " << c << " " << std::endl;
      usage();
    }
  }

  if (!l) {
    std::cerr << "l not set." << std::endl;
    usage();
  }

  awgn_simulation(uncoded(l), 0.5, seed)();
}
<commit_msg>Add static specifier and noreturn attribute to usage()<commit_after>#include <iostream>

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <getopt.h>

#include "codes/uncoded.h"
#include "simulation/simulation.h"

[[noreturn]] static void usage() {
  std::cout << "--l <num>        "
            << "  "
            << "Choose code length l" << std::endl;
  std::cout << "--seed <num>     "
            << "  "
            << "Set seed of the random number generator." << std::endl;
  exit(-1);
}

int main(int argc, char *const argv[]) {
  unsigned long l = 0;
  uint64_t seed = 0;

  while (1) {
    static struct option options[] = {
      { "l", required_argument, nullptr, 'l' },
      { "seed", required_argument, nullptr, 's' },
      { nullptr, 0, nullptr, 0 },
    };

    int option_index = 0;
    int c = getopt_long_only(argc, argv, "", options, &option_index);
    if (c == -1)
      break;

    switch (c) {
    case 'l':
      l = strtoul(optarg, nullptr, 0);
      break;
    case 's':
      seed = strtoull(optarg, nullptr, 0);
      break;
    default:
      std::cerr << "Unkown argument: " << c << " " << std::endl;
      usage();
    }
  }

  if (!l) {
    std::cerr << "l not set." << std::endl;
    usage();
  }

  awgn_simulation(uncoded(l), 0.5, seed)();
}

{'fraction_non_alphanumeric': 0.17813121272365806, 'fraction_numerical': 0.011133200795228629, 'mean_word_length': 2.3105263157894735, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 11, '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': '6857311', 'n_tokens_mistral': 928, 'n_tokens_neox': 895, 'n_words': 235}