Ethereal-dev: Re: [Ethereal-dev] Warning fixes (unused params)

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Thu, 2 May 2002 13:57:33 -0700
On Thu, May 02, 2002 at 01:43:18PM +0200, Joerg Mayer wrote:
> > 	the generated dissectors for some GIOP protocols - fixing that
> > 	"right", may be hard, as the generator might not know whether
> > 	the variable in the boilerplate it generates will be used, so it
> > 	might just have to flag *variables* with _U_ (it's generated
> > 	code, so that sort of ugliness doesn't bother me all that much);
> 
> I'm thinking about another solution, but I don't know how portable it is:
> add the following to the compile flags:
> -Wall -W ... `test -r .nowarn && cat .nowarn` ...
> and put a file .nowarn with -Wno-unused as its sole content into the
> directory. This makes two assumptions: 1) `...` is supported by standard
> make (it works with gnu make) and 2) that the dissectors in question are
> located in a directory of their own (which they curently are).

Well, that

	1) requires people to know to create a ".nowarn" file in the
	   directory for their GIOP dissectors, if they don't put them
	   in "plugins/giop" and want to avoid warnings

and

	2) depends on the behavior of "make".

Here's a patch to "ethereal_gen.py" that inserts some _U_'s that I think
should suppress most, if not all, of the warnings.  I don't have omniidl
here, so I haven't tried it.
Index: ethereal_gen.py
===================================================================
RCS file: /usr/local/cvsroot/ethereal/ethereal_gen.py,v
retrieving revision 1.23
diff -c -r1.23 ethereal_gen.py
*** ethereal_gen.py	19 Apr 2002 22:23:37 -0000	1.23
--- ethereal_gen.py	2 May 2002 20:55:05 -0000
***************
*** 1609,1615 ****
  
  
      template_helper_function_start = """\
! static void decode_@sname@(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, MessageHeader *header, gchar *operation) {
  
      gboolean stream_is_big_endian;          /* big endianess */
  """
--- 1609,1615 ----
  
  
      template_helper_function_start = """\
! static void decode_@sname@(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_) {
  
      gboolean stream_is_big_endian;          /* big endianess */
  """
***************
*** 1710,1716 ****
  }
  
  G_MODULE_EXPORT void
! plugin_init(plugin_address_table_t *pat){
     /* initialise the table of pointers needed in Win32 DLLs */
     plugin_address_table_init(pat);
     if (proto_@dissector_name@ == -1) {
--- 1710,1720 ----
  }
  
  G_MODULE_EXPORT void
! plugin_init(plugin_address_table_t *pat
! #ifndef PLUGINS_NEED_ADDRESS_TABLE
! _U_
! #endif
! ){
     /* initialise the table of pointers needed in Win32 DLLs */
     plugin_address_table_init(pat);
     if (proto_@dissector_name@ == -1) {
***************
*** 2212,2218 ****
  #
  
      template_main_dissector_start = """\
! static gboolean dissect_@dissname@(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset, MessageHeader *header, gchar *operation, gchar *idlname) {
  
      proto_item *ti = NULL;
      proto_tree *tree = NULL;            /* init later, inside if(tree) */
--- 2216,2222 ----
  #
  
      template_main_dissector_start = """\
! static gboolean dissect_@dissname@(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset, MessageHeader *header, gchar *operation, gchar *idlname _U_) {
  
      proto_item *ti = NULL;
      proto_tree *tree = NULL;            /* init later, inside if(tree) */
***************
*** 2380,2388 ****
   *
   */
   
! static gboolean decode_user_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, MessageHeader *header, gchar *operation ) {
      
!     gboolean be;                        /* big endianess */
  
      
  """
--- 2384,2392 ----
   *
   */
   
! static gboolean decode_user_exception(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header _U_, gchar *operation _U_ ) {
      
!     gboolean be _U_;                        /* big endianess */
  
      
  """