/*1* Mesa 3-D graphics library2*3* Copyright (C) 2010 LunarG Inc.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the "Software"),7* to deal in the Software without restriction, including without limitation8* the rights to use, copy, modify, merge, publish, distribute, sublicense,9* and/or sell copies of the Software, and to permit persons to whom the10* Software is furnished to do so, subject to the following conditions:11*12* The above copyright notice and this permission notice shall be included13* in all copies or substantial portions of the Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL18* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER19* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING20* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER21* DEALINGS IN THE SOFTWARE.22*23* Authors:24* Chia-I Wu <[email protected]>25*/2627#include <stdbool.h>28#include <stdlib.h>29#include <stdio.h>30#include <string.h>3132#include "c11/threads.h"33#include "table.h"3435static nop_handler_proc nop_handler = NULL;3637void38table_set_noop_handler(nop_handler_proc func)39{40nop_handler = func;41}4243static bool log_noop;4445static void check_debug_env(void)46{47const char *debug = getenv("MESA_DEBUG");48if (!debug)49debug = getenv("LIBGL_DEBUG");50if (debug && strcmp(debug, "silent") != 0)51log_noop = true;52}5354static void55noop_warn(const char *name)56{57if (nop_handler) {58nop_handler(name);59}60else {61static once_flag flag = ONCE_FLAG_INIT;62call_once(&flag, check_debug_env);6364if (log_noop)65fprintf(stderr, "%s is no-op\n", name);66}67}6869static int70noop_generic(void)71{72noop_warn("function");73return 0;74}7576/* define noop_array */77#define MAPI_TMP_DEFINES78#define MAPI_TMP_NOOP_ARRAY79#include "mapi_tmp.h"808182