diff --git a/ncdump/inttags4.cdl b/ncdump/inttags4.cdl index 806469c1d..27840d14e 100644 --- a/ncdump/inttags4.cdl +++ b/ncdump/inttags4.cdl @@ -19,5 +19,5 @@ data: i64 = 9223372036854775807LL, 9223372036854775807ll, 9223372036854775807 ; - ui64 = 18446744073709551615ULL, 18446744073709551615ull, 18446744073709551615u ; + ui64 = 18446744073709551615ULL, 18446744073709551615ull, 18446744073709551615uLL; } diff --git a/ncgen/Makefile.am b/ncgen/Makefile.am index f1e646be3..9d28dcd79 100644 --- a/ncgen/Makefile.am +++ b/ncgen/Makefile.am @@ -24,7 +24,8 @@ man_MANS = ncgen.1 EXTRA_DIST = ncgen.y ncgen.l ncgenl.c $(man_MANS) internals.html \ run_tests.sh run_nc4_tests.sh c0.cdl c0_4.cdl ref_camrun.cdl \ ncf199.cdl CMakeLists.txt XGetopt.c c5.cdl \ -compound_datasize_test.cdl compound_datasize_test2.cdl tst_gattenum.cdl +compound_datasize_test.cdl compound_datasize_test2.cdl \ +tst_gattenum.cdl tst_usuffix.cdl # This shell script causes ncgen to build a classic and a 64-bit # offset file from a cdl file shipped with the distribution. @@ -39,6 +40,7 @@ CLEANFILES = c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c \ ncf199.nc c5.nc compound_datasize_test.nc compound_datasize_test2.nc \ tst_compound_datasize_test.cdl tst_compound_datasize_test2.cdl tst_ncf199.cdl \ tst_tst_gattenum.cdl tst_gattenum.nc \ + tst_tst_usuffix.cdl tst_usuffix.nc \ tst_c0.cdl tst_c0_4.cdl tst_c0_4c.cdl tst_c0_64.cdl # These rules are used if someone wants to rebuild ncgenl.c or ncgeny.c diff --git a/ncgen/ncgen.l b/ncgen/ncgen.l index e7f7aa0ff..42ff6dca1 100644 --- a/ncgen/ncgen.l +++ b/ncgen/ncgen.l @@ -839,7 +839,7 @@ collecttag(char* text, char** stagp) stag[MAXTAGLEN] = '\0'; if(stag[0] == 'U' || stag[0] == 'u') { hasU = 1; - memmove(stag,stag+1,MAXTAGLEN); + memmove(stag,stag+1,MAXTAGLEN); staglen--; } else if(stag[staglen-1] == 'U' || stag[staglen-1] == 'u') { hasU = 1; @@ -847,7 +847,7 @@ collecttag(char* text, char** stagp) stag[staglen] = '\0'; } if(strlen(stag) == 0 && hasU) { - tag = NC_UINT64; + tag = NC_UINT; } else if(strlen(stag) == 1) { switch (stag[0]) { case 'B': case 'b': tag = (hasU ? NC_UBYTE : NC_BYTE); break; diff --git a/ncgen/ncgenl.c b/ncgen/ncgenl.c index 024298d52..2987187cf 100644 --- a/ncgen/ncgenl.c +++ b/ncgen/ncgenl.c @@ -3391,7 +3391,7 @@ collecttag(char* text, char** stagp) stag[MAXTAGLEN] = '\0'; if(stag[0] == 'U' || stag[0] == 'u') { hasU = 1; - memmove(stag,stag+1,MAXTAGLEN); + memmove(stag,stag+1,MAXTAGLEN); staglen--; } else if(stag[staglen-1] == 'U' || stag[staglen-1] == 'u') { hasU = 1; @@ -3399,7 +3399,7 @@ collecttag(char* text, char** stagp) stag[staglen] = '\0'; } if(strlen(stag) == 0 && hasU) { - tag = NC_UINT64; + tag = NC_UINT; } else if(strlen(stag) == 1) { switch (stag[0]) { case 'B': case 'b': tag = (hasU ? NC_UBYTE : NC_BYTE); break; diff --git a/ncgen/run_nc4_tests.sh b/ncgen/run_nc4_tests.sh index e9bb09b85..e7b0a556d 100755 --- a/ncgen/run_nc4_tests.sh +++ b/ncgen/run_nc4_tests.sh @@ -57,5 +57,8 @@ validateNC "compound_datasize_test2" "compound_datasize_test2" -k nc4 echo "*** Global Attribute with Enum type" validateNC "tst_gattenum" "tst_gattenum" -k nc4 +echo "*** Integer constant with just 'u' suffix" +validateNC "tst_usuffix" "tst_usuffix" -k nc4 + echo "*** Test successful!" exit 0 diff --git a/ncgen/tst_usuffix.cdl b/ncgen/tst_usuffix.cdl new file mode 100644 index 000000000..8b0a7fd2f --- /dev/null +++ b/ncgen/tst_usuffix.cdl @@ -0,0 +1,9 @@ +netcdf tst_usuffix { +variables: + float att_var ; + att_var:uint_att = 73U ; + att_var:uint_att2 = 73U ; +data: + + att_var = 10 ; +}