source: diffutils/vendor/current/gnulib-tests/test-ignore-value.c@ 530

Last change on this file since 530 was 530, checked in by Yuri Dario, 12 years ago

diffutils: initial vendor import of diffutils 3.2.0.

File size: 2.0 KB
Line 
1/* -*- buffer-read-only: t -*- vi: set ro: */
2/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3/* Test the "ignore-value" module.
4
5 Copyright (C) 2011 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20/* Written by Eric Blake. */
21
22#include <config.h>
23
24#include "ignore-value.h"
25
26#include <stdio.h>
27
28#ifndef _GL_ATTRIBUTE_RETURN_CHECK
29# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
30# define _GL_ATTRIBUTE_RETURN_CHECK
31# else
32# define _GL_ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__))
33# endif
34#endif
35
36struct s { int i; };
37static char doChar (void) _GL_ATTRIBUTE_RETURN_CHECK;
38static int doInt (void) _GL_ATTRIBUTE_RETURN_CHECK;
39static off_t doOff (void) _GL_ATTRIBUTE_RETURN_CHECK;
40static void *doPtr (void) _GL_ATTRIBUTE_RETURN_CHECK;
41static struct s doStruct (void) _GL_ATTRIBUTE_RETURN_CHECK;
42
43static char
44doChar (void)
45{
46 return 0;
47}
48
49static int
50doInt (void)
51{
52 return 0;
53}
54
55static off_t
56doOff (void)
57{
58 return 0;
59}
60
61static void *
62doPtr (void)
63{
64 return NULL;
65}
66
67static struct s
68doStruct (void)
69{
70 static struct s s1;
71 return s1;
72}
73
74int
75main (void)
76{
77 /* If this test can compile with -Werror and the same warnings as
78 the rest of the project, then we are properly silencing warnings
79 about ignored return values. */
80 ignore_value (doChar ());
81 ignore_value (doInt ());
82 ignore_value (doOff ());
83 ignore_value (doPtr ());
84 ignore_value (doStruct ());
85 return 0;
86}
Note: See TracBrowser for help on using the repository browser.