]> git.ipfire.org Git - thirdparty/gcc.git/blame - liboffloadmic/runtime/liboffload_msg.c
backport: Makefile.am (myo_inc_dir): Remove.
[thirdparty/gcc.git] / liboffloadmic / runtime / liboffload_msg.c
CommitLineData
5f520819 1/*
df26a50d 2 Copyright (c) 2014-2016 Intel Corporation. All Rights Reserved.
5f520819
KY
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions
6 are met:
7
8 * Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its
14 contributors may be used to endorse or promote products derived
15 from this software without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30
5f520819
KY
31#include <stdarg.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <string.h>
35
36// ===========================================================================
37// Bring in the static string table and the enumerations for indexing into
38// it.
39// ===========================================================================
40
41#include "liboffload_msg.h"
42
43# define DYNART_STDERR_PUTS(__message_text__) fputs((__message_text__),stderr)
44
45// ===========================================================================
46// Now the code for accessing the message catalogs
47// ===========================================================================
48
49
50 void write_message(FILE * file, int msgCode, va_list args_p) {
51 va_list args;
52 char buf[1024];
53
54 va_copy(args, args_p);
55 buf[0] = '\n';
56 vsnprintf(buf + 1, sizeof(buf) - 2,
2eab9666 57 MESSAGE_TABLE_NAME[ msgCode ], args);
5f520819
KY
58 strcat(buf, "\n");
59 va_end(args);
60 fputs(buf, file);
61 fflush(file);
62 }
63
64 char const *offload_get_message_str(int msgCode) {
65 return MESSAGE_TABLE_NAME[ msgCode ];
66 }