Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int f(int z) {
- return z + (z*2) + z/3 + z*z + 23;
- }
- int main()
- {
- int i = 7;
- f(i); ///// <<----- here I disregard the return value
- return 1;
- }
- #define WARN_UNUSED __attribute__((warn_unused_result))
- int WARN_UNUSED f(int z) {
- return z + (z*2) + z/3 + z*z + 23;
- }
- int main()
- {
- int i = 7;
- f(i); ///// <<----- here i disregard the return value
- return 1;
- }
- $ gcc test.c
- test.c: In function `main':
- test.c:16: warning: ignoring return value of `f', declared with
- attribute warn_unused_result
- unsigned long __must_check copy_to_user(void __user *to,
- const void *from, unsigned long n);
- int fn() __attribute__((warn_unused_result));
- class return_value
- {
- public:
- explicit return_value(T value)
- :value(value), checked(false)
- {
- }
- return_value(const return_value& other)
- :value(other.value), checked(other.checked)
- {
- other.checked = true;
- }
- return_value& operator=(const return_value& other)
- {
- if( this != &other )
- {
- assert(checked);
- value = other.value;
- checked = other.checked;
- other.checked = true;
- }
- }
- ~return_value(const return_value& other)
- {
- assert(checked);
- }
- T get_value()const {
- checked = true;
- return value;
- }
- private:
- mutable bool checked;
- T value;
- };
- grep -rn "function_name" * | grep -v "="
- if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
- signal(SIGHUP, sighandler);
- if ((old = signal(SIGHUP, SIG_IGN)) != SIG_IGN)
- old = signal(SIGHUP, sighandler);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement