Skip to contentSkip to conversation

tools/perf compile error: ignoring return value of 'read', declared with attribute warn_unused_result

DISCUSSION Kevin Winchester 2 participants 3 messages Jul 1, 2009 – Jul 2, 2009

lore
Share & tools
lore
#0 lore raw

CC builtin-stat.o
cc1: warnings being treated as errors
builtin-stat.c: In function 'run_perf_stat':
builtin-stat.c:243: error: ignoring return value of 'read', declared with attribute warn_unused_result builtin-stat.c:256: error: ignoring return value of 'read', declared with attribute warn_unused_result
make: *** [builtin-stat.o] Error 1

Apparently my version of gcc and/or glibc do not agree with -Werror. Would the fix be as simple as:

    if *read(go_pipe[0], &buf, 1) < 0) {
            perror("Failed to read go_pipe.");
            exit(1);
    }

?

Signature · 1 line
Kevin Winchester
#1 lore raw
Quoted 7 lines · Kevin Winchester

CC builtin-stat.o
cc1: warnings being treated as errors
builtin-stat.c: In function 'run_perf_stat':
builtin-stat.c:243: error: ignoring return value of 'read', declared with attribute warn_unused_result builtin-stat.c:256: error: ignoring return value of 'read', declared with attribute warn_unused_result
make: *** [builtin-stat.o] Error 1

Quoted 8 lines

Apparently my version of gcc and/or glibc do not agree with -Werror. Would the fix be as simple as:

    if *read(go_pipe[0], &buf, 1) < 0) {
            perror("Failed to read go_pipe.");
            exit(1);
    }

?

Yeah, that's Ubuntu doing some must-check-warnings via headers, right?

Frederic fixed a bug there yesterday - mind checking the latest perfcounters code at:

http://people.redhat.com/mingo/tip.git/README

?

Thanks,

Ingo

#2 lore raw
Quoted 21 lines · Ingo Molnar
Quoted 7 lines · Kevin Winchester

CC builtin-stat.o
cc1: warnings being treated as errors
builtin-stat.c: In function 'run_perf_stat':
builtin-stat.c:243: error: ignoring return value of 'read', declared with attribute warn_unused_result builtin-stat.c:256: error: ignoring return value of 'read', declared with attribute warn_unused_result
make: *** [builtin-stat.o] Error 1

Quoted 8 lines

Apparently my version of gcc and/or glibc do not agree with -Werror. Would the fix be as simple as:

    if *read(go_pipe[0], &buf, 1) < 0) {
            perror("Failed to read go_pipe.");
            exit(1);
    }

?

Yeah, that's Ubuntu doing some must-check-warnings via headers, right?

Quoted 7 lines

Frederic fixed a bug there yesterday - mind checking the latest perfcounters code at:

http://people.redhat.com/mingo/tip.git/README

?

It's Gentoo, actually, but likely the same issue. I checked tip/master and it does not show the problem.

Thanks for taking the time to look into it,

Signature · 1 line
Kevin Winchester