* gcc.dg/20150120-1.c (dg-final): Cleanup original tree dump.
[official-gcc.git] / liboffloadmic / runtime / liboffload_msg.c
blobc6d9fa7db1e4bd2ffbe5da68b45b9d39c199cabf
1 /*
2 Copyright (c) 2014 Intel Corporation. All Rights Reserved.
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions
6 are met:
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.
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.
32 #include <stdarg.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
37 // ===========================================================================
38 // Bring in the static string table and the enumerations for indexing into
39 // it.
40 // ===========================================================================
42 #include "liboffload_msg.h"
44 # define DYNART_STDERR_PUTS(__message_text__) fputs((__message_text__),stderr)
46 // ===========================================================================
47 // Now the code for accessing the message catalogs
48 // ===========================================================================
51 void write_message(FILE * file, int msgCode, va_list args_p) {
52 va_list args;
53 char buf[1024];
55 va_copy(args, args_p);
56 buf[0] = '\n';
57 vsnprintf(buf + 1, sizeof(buf) - 2,
58 MESSAGE_TABLE_NAME[ msgCode ], args);
59 strcat(buf, "\n");
60 va_end(args);
61 fputs(buf, file);
62 fflush(file);
65 char const *offload_get_message_str(int msgCode) {
66 return MESSAGE_TABLE_NAME[ msgCode ];