Hi Lars,
On 11/10/05, Lars Marowsky-Bree <[EMAIL PROTECTED]> wrote:
> On 2005-10-31T11:31:52, Xun Sun <[EMAIL PROTECTED]> wrote:
>
> > Hello,
> > Is this problem still worth investigating? I am not going to make a
> > patch if nobody will need it :)
>
> Yes, the problem still exists. If you could send your patch, that would
> be helpful.
>
I have come up with the attached patch, could you please check if it
fixes your problem?
This tries to compile the unused_return_result_test.c twice, with the
only difference being whether we get the return code of fwrite(). If
and only if the first fails and second succeeds, we know that we
should do something with the conf_lex.l file.
This diff file was not generated by diff directly, but I cat'ted 3
independent diff files together to get it. Thus don't be surprised if
it can not apply cleanly...
> Another alternative would be to post-process the generated code. ;-)
>
>
> Sincerely,
> Lars Marowsky-Brée <[EMAIL PROTECTED]>
>
> --
> High Availability & Clustering
> SUSE Labs, Research and Development
> SUSE LINUX Products GmbH - A Novell Business -- Charles Darwin
> "Ignorance more frequently begets confidence than does knowledge"
>
> _______________________________________________________
> Linux-HA-Dev: [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>
--
Thanks & regards
Xun Sun
--- linux-ha.orig/configure.in 2005-11-12 02:00:34.120487232 +0800
+++ linux-ha/configure.in 2005-11-12 01:39:20.178155904 +0800
@@ -1647,9 +1647,33 @@
ANSI="-ansi -D_GNU_SOURCE -DANSI_ONLY"
fi
- if test "${enable_fatal_warnings}" = yes && cc_supports_flag -Werror ; then
- echo "Enabling Fatal Warnings (-Werror) on this platform"
- FATAL_WARNINGS="-Werror"
+ if cc_supports_flag -Werror ; then
+ if test "${enable_fatal_warnings}" = yes; then
+ echo "Enabling Fatal Warnings (-Werror) on this platform"
+ FATAL_WARNINGS="-Werror"
+ fi
+
+ AC_MSG_CHECKING(whether fwrite() is declared with warn_unused_result attribute)
+
+ ac_save_CFLAGS=$CFLAGS
+ CFLAGS="-Werror"
+ AC_COMPILE_IFELSE(`cat $srcdir/config/unused_return_result_test.c`, [rc=0], [rc=1])
+ if test "$rc" = 1; then
+ CFLAGS="-DUSE_RETURNED_RESULT $CFLAGS"
+ AC_COMPILE_IFELSE(`cat $srcdir/config/unused_return_result_test.c`, [rc=0], [rc=1])
+ if test "$rc" = 0; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(USE_RETURNED_RESULT, 1, [define to 1 if some of the library \
+ functions we call are declared with warn_unused_result attribute])
+ else
+ AC_MSG_RESULT(no)
+ fi
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ CFLAGS=$ac_save_CFLAGS
+
fi
if test "$enable_traditional_warning" = yes && \
--- linux-ha.orig/telecom/recoverymgrd/conf_lex.l 2005-08-03 22:33:16.000000000 +0800
+++ linux-ha/telecom/recoverymgrd/conf_lex.l 2005-11-12 01:39:35.069892016 +0800
@@ -40,6 +40,10 @@
# define MAKE_WARNINGS_GO_AWAY ;
#endif
+#ifdef USE_RETURNED_RESULT
+ size_t rc;
+# define ECHO rc=fwrite( yytext, yyleng, 1, yyout)
+#endif
%}
%{
--- linux-ha.orig/config/unused_return_result_test.c 2005-11-12 02:15:12.228994448 +0800
+++ linux-ha/config/unused_return_result_test.c 2005-11-12 00:58:49.520672008 +0800
@@ -0,0 +1,11 @@
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+#ifdef USE_RETURN_RESULT
+ size_t rc;
+ rc = fwrite("unused", 7, 1, stdout);
+#else
+ fwrite("unused", 7, 1, stdout);
+#endif
+ return 0;
+}
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/