I got a few warnings about assignments of pointers to "bool" values.
I think these are legitimate gripes, because on platforms where bool
is only a byte wide, the net effect will be to assign the pointer's
low-order byte to the bool.  There's at least a 1-in-256 chance of
a non-null pointer erroneously converting to a "false" boolean value
(maybe more than that, if the pointer is likely to be aligned ...).

I propose the attached patches to fix this.

                        regards, tom lane

diff -c -r orig/ccache-3.2.3/ccache.c ccache-3.2.3/ccache.c
*** orig/ccache-3.2.3/ccache.c	Sun Aug 16 08:12:05 2015
--- ccache-3.2.3/ccache.c	Sun Aug 16 14:59:46 2015
***************
*** 1263,1269 ****
  compiler_is_clang(struct args *args)
  {
  	char *name = basename(args->argv[0]);
! 	bool is = strstr(name, "clang");
  	free(name);
  	return is;
  }
--- 1263,1269 ----
  compiler_is_clang(struct args *args)
  {
  	char *name = basename(args->argv[0]);
! 	bool is = strstr(name, "clang") != NULL;
  	free(name);
  	return is;
  }
diff -c -r orig/ccache-3.2.3/conf.c ccache-3.2.3/conf.c
*** orig/ccache-3.2.3/conf.c	Sun Aug 16 08:12:05 2015
--- ccache-3.2.3/conf.c	Sun Aug 16 15:01:12 2015
***************
*** 58,64 ****
  	char **value = (char **)result;
  	free(*value);
  	*value = subst_env_in_string(str, errmsg);
! 	return *value;
  }
  
  static bool
--- 58,64 ----
  	char **value = (char **)result;
  	free(*value);
  	*value = subst_env_in_string(str, errmsg);
! 	return *value != NULL;
  }
  
  static bool
diff -c -r orig/ccache-3.2.3/language.c ccache-3.2.3/language.c
*** orig/ccache-3.2.3/language.c	Sun Aug 16 08:12:05 2015
--- ccache-3.2.3/language.c	Sun Aug 16 15:01:01 2015
***************
*** 149,155 ****
  bool
  language_is_supported(const char *language)
  {
! 	return p_language_for_language(language);
  }
  
  bool
--- 149,155 ----
  bool
  language_is_supported(const char *language)
  {
! 	return p_language_for_language(language) != NULL;
  }
  
  bool
diff -c -r orig/ccache-3.2.3/util.c ccache-3.2.3/util.c
*** orig/ccache-3.2.3/util.c	Sun Aug 16 08:12:05 2015
--- ccache-3.2.3/util.c	Sun Aug 16 15:00:41 2015
***************
*** 1638,1644 ****
  	if (curly) {
  		if (*q != '}') {
  			*errmsg = format("syntax error: missing '}' after \"%s\"", p);
! 			return NULL;
  		}
  	}
  
--- 1638,1644 ----
  	if (curly) {
  		if (*q != '}') {
  			*errmsg = format("syntax error: missing '}' after \"%s\"", p);
! 			return false;
  		}
  	}
  
_______________________________________________
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache

Reply via email to