<commit_before>/*
 * Copyright 2016, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
 * See "LICENSE_BSD2.txt" for details.
 *
 * @TAG(NICTA_BSD)
 */

#pragma once

/* macros for forcing the compiler to leave in statments it would
 * normally optimize away */

#include <utils/attribute.h>
#include <utils/stringify.h>

/* Macro for doing dummy reads
 *
 * Expands to a volatile, unused variable which is set to the value at
 * a given address. It's volatile to prevent the compiler optimizing
 * away a variable that is written but never read, and it's unused to
 * prevent warnings about a variable that's never read.
 */
#define FORCE_READ(address) \
        volatile UNUSED typeof(*address) JOIN(__force__read, __COUNTER__) = *(address)
<commit_msg>libutils: Rephrase FORCE_READ into something safer.<commit_after>/*
 * Copyright 2016, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
 * See "LICENSE_BSD2.txt" for details.
 *
 * @TAG(NICTA_BSD)
 */

#pragma once

/* macros for forcing the compiler to leave in statments it would
 * normally optimize away */

#include <utils/attribute.h>
#include <utils/stringify.h>

/* Macro for doing dummy reads
 *
 * Forces a memory read access to the given address.
 */
#define FORCE_READ(address) \
    do { \
        typeof(*(address)) *_ptr = (address); \
        asm volatile ("" : "=m"(*_ptr) : "r"(*_ptr)); \
    } while (0)

{'fraction_non_alphanumeric': 0.10158730158730159, 'fraction_numerical': 0.008253968253968255, 'mean_word_length': 3.608187134502924, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2244104', 'n_tokens_mistral': 485, 'n_tokens_neox': 459, 'n_words': 190}