This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: cpplib: more type correctness


Zack Weinberg wrote:- > The principle is good, but I'm going to be picky again. There are a > few issues with this. The most important one is: > > - Why have you changed a number of interfaces to take const char * > instead of const unsigned char * ? I believe this is true; but I'll check again. In each case it moves the char * / U_CHAR * boundary in the code further out by one function, which you may prefer not happen, but with the advantage of fewer casts IIRC. The functions are short, and IIRC tend to do a copy and call push_cpp_buffer, at which point the pointers are U_CHAR *. > - Don't cast between U_CHAR * and char * except when passing U_CHAR * > to or from a C library function that takes plain char *, or when > assigning a string constant to a U_CHAR * variable. Fix the types > instead. > > - If you're going to cast the argument of free, cast it to (PTR). > - It's not necessary to cast the return value of malloc to char * or > const char *. It is necessary to cast it to U_CHAR *. OK. I'll resend a patch. > - I see a number of places where you set ihash->control_macro to > (U_CHAR *) "". Instead, you should make ihash->control_macro be > const. It already is const (from the previous patch); instead the cast removes the signedness conflict, which is reported by -Wwrite-strings. > Do you have write privileges yet? I haven't seen MAINTAINERS be > updated. Hmmm, yes and I believe it has been. Neil.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]