CLD2Owners/cld2

cld2/public/compact_lang_det.h should include .../encodings.h and stdio.h

zackw opened this issue · 0 comments

zackw commented

cld2/public/compact_lang_det.h does not include all the headers it needs. The more obvious problem is failure to include stdio.h, which causes compilation to fail:

$ printf '#include <cld2/public/compact_lang_det.h>\nint foo;\n' | 
  g++ -fsyntax-only -fmessage-length=72 -x c++ -
In file included from <stdin>:1:0:
/usr/include/cld2/public/compact_lang_det.h:379:28: error: variable
   or field ‘DumpResultChunkVector’ declared void
 void DumpResultChunkVector(FILE* f, const char* src,
                            ^
/usr/include/cld2/public/compact_lang_det.h:379:28: error: ‘FILE’
    was not declared in this scope
/usr/include/cld2/public/compact_lang_det.h:379:34: error: ‘f’
    was not declared in this scope
 void DumpResultChunkVector(FILE* f, const char* src,
                                  ^
/usr/include/cld2/public/compact_lang_det.h:379:37: error: expected
   primary-expression before ‘const’
 void DumpResultChunkVector(FILE* f, const char* src,
                                     ^
/usr/include/cld2/public/compact_lang_det.h:380:45: error: expected
   primary-expression before ‘*’ token
                            ResultChunkVector* resultchunkvector);
                                             ^
/usr/include/cld2/public/compact_lang_det.h:380:47: error: ‘resultchunkvector’
    was not declared in this scope
                            ResultChunkVector* resultchunkvector);
                                               ^

The more subtle problem is that it doesn't include cld2/public/encodings.h either; this header is required in order to pass a valid encoding hint. (This would be minor if UNKNOWN_ENCODING had the value zero, but it doesn't.)