albrecht.gebhardt@uni-klu.ac.at
1999-Nov-23 14:14 UTC
compile error for mkString on alpha (PR#332)
Full_Name: Albrecht Gebhardt Version: 0.90.0 OS: osf4.0 Submission from: (NULL) (143.205.61.73) I had to apply the following patch to be able to compile on an alpha with DU 4.0E: ############################################### --- ./src/main/gram.y.mkString-patch Tue Nov 23 12:16:29 1999 +++ ./src/main/gram.y Tue Nov 23 12:16:59 1999 @@ -56,7 +56,8 @@ SEXP mkFloat(char *); SEXP mkInteger(char *); SEXP mkNA(void); -SEXP mkString(const char *); +typedef const char cchar; +SEXP mkString(cchar *); SEXP mkTrue(void); /* Internal lexer / parser state variables */ @@ -1362,7 +1363,7 @@ } -SEXP mkString(const char *s) +SEXP mkString(cchar *s) { SEXP t; ################################################ Without the patch I got: cc -I. -I../include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -ieee_with_inexact -g -c gram.c -o gram.o cc: Warning: ../../../R/src/main/gram.y, line 1626: # not in column 1 is ignored, skipping to end of line. (ignoretokens) #if 0 ------------^ cc: Warning: ../../../R/src/main/gram.y, line 1628: # not in column 1 is ignored, skipping to end of line. (ignoretokens) #endif ------------^ cc: Warning: ../../../R/src/main/gram.y, line 644: In this statement, the referenced type of the pointer value "SourceLine" is "unsigned char", which is not compatible with "const signed char". (ptrmismatch) STRING(source)[lines++] = mkChar(SourceLine); ------------------------------------------------------^ cc: Warning: ../../../R/src/main/gram.y, line 1144: In this statement, the referenced type of the pointer value "buf" is "signed char", which is not compatible with "un signed char". (ptrmismatch) buf, 1024, 1) == 0) return R_NilValue; ---------------------------------^ cc: Warning: ../../../R/src/main/gram.y, line 1177: In this statement, the referenced type of the pointer value "buf" is "signed char", which is not compatible with "un signed char". (ptrmismatch) buf, 1024, 1) == 0) return R_NilValue; ---------------------------------^ cc: Error: ../../../R/src/main/gram.y, line 1365: In this declaration, parameter 1 has a different type than specified in an earlier declaration of this function. (mism atparam) SEXP mkString(const char *s) -----^ cc: Error: ../../../R/src/main/gram.y, line 1365: In this declaration, the type of "mkString" is not compatible with the type of a previous declaration of "mkString" at line number 59 in file ../../../R/src/main/gram.y. (notcompat) SEXP mkString(const char *s) -----^ Then I looked at the preprocessed sources: cc -I. -I../include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -ieee_with_inexact -g -E gram.c > gram.E grep -n mkString gram.E 8915:SEXP mkString(const char*); 9564:SEXP mkString(const char *); 11995:SEXP mkString( char *s) 12179: protect(yylval = mkString(yytext)); I don't know why the third occurrence of "mkString(const char*);" (line 11995 of preproccessor output) has the "const" removed, it is present in the source! But the trick with typedefing "const char" to "cconst" in the patch above works. BTW, there are many warnings about mixing "char" and "unsigned char", not only in gram.c! Albrecht -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> albrecht gebhardt writes:> Full_Name: Albrecht Gebhardt > Version: 0.90.0 > OS: osf4.0 > Submission from: (NULL) (143.205.61.73)> I had to apply the following patch to be able to compile on > an alpha with DU 4.0E: > ############################################### > --- ./src/main/gram.y.mkString-patch Tue Nov 23 12:16:29 1999 > +++ ./src/main/gram.y Tue Nov 23 12:16:59 1999 > @@ -56,7 +56,8 @@ > SEXP mkFloat(char *); > SEXP mkInteger(char *); > SEXP mkNA(void); > -SEXP mkString(const char *); > +typedef const char cchar; > +SEXP mkString(cchar *); > SEXP mkTrue(void);> /* Internal lexer / parser state variables */ > @@ -1362,7 +1363,7 @@ > }> -SEXP mkString(const char *s) > +SEXP mkString(cchar *s) > { > SEXP t;> ################################################ > Without the patch I got:> cc -I. -I../include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H > -ieee_with_inexact -g -c gram.c -o gram.o > cc: Warning: ../../../R/src/main/gram.y, line 1626: # not in column 1 is > ignored, skipping to end of line. (ignoretokens) > #if 0 > ------------^ > cc: Warning: ../../../R/src/main/gram.y, line 1628: # not in column 1 is > ignored, skipping to end of line. (ignoretokens) > #endif > ------------^ > cc: Warning: ../../../R/src/main/gram.y, line 644: In this statement, the > referenced type of the pointer value "SourceLine" is "unsigned char", which is > not compatible > with "const signed char". (ptrmismatch) > STRING(source)[lines++] = mkChar(SourceLine); > ------------------------------------------------------^ > cc: Warning: ../../../R/src/main/gram.y, line 1144: In this statement, the > referenced type of the pointer value "buf" is "signed char", which is not > compatible with "un > signed char". (ptrmismatch) > buf, 1024, 1) == 0) return R_NilValue; > ---------------------------------^ > cc: Warning: ../../../R/src/main/gram.y, line 1177: In this statement, the > referenced type of the pointer value "buf" is "signed char", which is not > compatible with "un > signed char". (ptrmismatch) > buf, 1024, 1) == 0) return R_NilValue; > ---------------------------------^ > cc: Error: ../../../R/src/main/gram.y, line 1365: In this declaration, parameter > 1 has a different type than specified in an earlier declaration of this > function. (mism > atparam) > SEXP mkString(const char *s) > -----^ > cc: Error: ../../../R/src/main/gram.y, line 1365: In this declaration, the type > of "mkString" is not compatible with the type of a previous declaration of > "mkString" at > line number 59 in file ../../../R/src/main/gram.y. (notcompat) > SEXP mkString(const char *s) > -----^> Then I looked at the preprocessed sources: > cc -I. -I../include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H > -ieee_with_inexact -g -E gram.c > gram.E> grep -n mkString gram.E > 8915:SEXP mkString(const char*); > 9564:SEXP mkString(const char *); > 11995:SEXP mkString( char *s) > 12179: protect(yylval = mkString(yytext));> I don't know why the third occurrence of "mkString(const char*);" > (line 11995 of preproccessor output) has the "const" removed, it is present in > the > source! But the trick with typedefing "const char" to "cconst" in the patch > above works.> BTW, there are many warnings about mixing "char" and "unsigned char", > not only in gram.c!> AlbrechtI am not sure that this is the right way of fixing it. configure has a macro called AC_C_CONST which checks whether the C compiler fully supports the `const' keyword. If not, `const' is defined empty. Can you look at you Rconfig.h and see if anything is done about const there? Can you also look at config.log? Thanks -k -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._