[530] | 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 |
|
---|
| 36 | struct s { int i; };
|
---|
| 37 | static char doChar (void) _GL_ATTRIBUTE_RETURN_CHECK;
|
---|
| 38 | static int doInt (void) _GL_ATTRIBUTE_RETURN_CHECK;
|
---|
| 39 | static off_t doOff (void) _GL_ATTRIBUTE_RETURN_CHECK;
|
---|
| 40 | static void *doPtr (void) _GL_ATTRIBUTE_RETURN_CHECK;
|
---|
| 41 | static struct s doStruct (void) _GL_ATTRIBUTE_RETURN_CHECK;
|
---|
| 42 |
|
---|
| 43 | static char
|
---|
| 44 | doChar (void)
|
---|
| 45 | {
|
---|
| 46 | return 0;
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | static int
|
---|
| 50 | doInt (void)
|
---|
| 51 | {
|
---|
| 52 | return 0;
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | static off_t
|
---|
| 56 | doOff (void)
|
---|
| 57 | {
|
---|
| 58 | return 0;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | static void *
|
---|
| 62 | doPtr (void)
|
---|
| 63 | {
|
---|
| 64 | return NULL;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | static struct s
|
---|
| 68 | doStruct (void)
|
---|
| 69 | {
|
---|
| 70 | static struct s s1;
|
---|
| 71 | return s1;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | int
|
---|
| 75 | main (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 | }
|
---|