microsoft / microsoft/vscode-cpptools
Leverage compiler system defines to determine types and sizes for IntelliSense
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.2k
- Forks
- 1.7k
- Merge medio
- 14 h 46 min
- PR fusionados (30 d)
- 61
Descripción
Various type and sizes are essentially hard-coded per IntelliSense mode. Some are passed in based on a static file (such as __SIZE_TYPE__ and __PTRDIFF_TYPE in linux.gcc.x64.json). Some are hard-coded in the IntelliSense parser, based on the compiler and architecture (IntelliSense mode).
gcc/clang compilers will output types and sizes when queried, such as:
c:\msys64\mingw64\bin>gcc.exe -x c++ -E -dM nul | findstr /i SIZEOF
#define __SIZEOF_FLOAT80__ 16
#define __SIZEOF_LONG__ 4
#define __SIZEOF_LONG_DOUBLE__ 16
#define __SIZEOF_FLOAT__ 4
#define __SIZEOF_SIZE_T__ 8
#define __SIZEOF_WINT_T__ 2
#define __SIZEOF_POINTER__ 8
#define __SIZEOF_PTRDIFF_T__ 8
#define __SIZEOF_INT__ 4
#define __SIZEOF_FLOAT128__ 16
#define __SIZEOF_SHORT__ 2
#define __SIZEOF_INT128__ 16
#define __SIZEOF_WCHAR_T__ 2
#define __SIZEOF_DOUBLE__ 8
#define __SIZEOF_LONG_LONG__ 8
c:\msys64\mingw64\bin>gcc.exe -x c++ -E -dM nul | findstr /i long
#define __UINTMAX_TYPE__ long long unsigned int
#define __SIZEOF_LONG__ 4
#define __SIZEOF_LONG_DOUBLE__ 16
#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
#define __LONG_LONG_WIDTH__ 64
#define __INT_FAST64_TYPE__ long long int
#define __SIZE_TYPE__ long long unsigned int
#define __UINT_LEAST64_TYPE__ long long unsigned int
#define __LONG_MAX__ 0x7fffffffL
#define __INT_LEAST64_TYPE__ long long int
#define __GCC_ATOMIC_LONG_LOCK_FREE 2
#define __INTPTR_TYPE__ long long int
#define __UINT_FAST64_TYPE__ long long unsigned int
#define __INT64_TYPE__ long long int
#define __UINT64_TYPE__ long long unsigned int
#define __LONG_WIDTH__ 32
#define __INTMAX_TYPE__ long long int
#define __PTRDIFF_TYPE__ long long int
#define __UINTPTR_TYPE__ long long unsigned int
#define __SIZEOF_LONG_LONG__ 8
#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
It's possible that different versions or flavors of the same compiler will output different values for these, even for the same architecture.
For example, both MinGW x64 and cygwin x64 are associated with the windows-gcc-x64 IntelliSense mode, but use different sizes for long.
D:\cygwin64\bin>gcc.exe -x c++ -E -dM /dev/null | findstr /i x86
#define __x86_64 1
D:\cygwin64\bin>gcc.exe -x c++ -E -dM /dev/null | findstr /i SIZEOF_LONG
#define __SIZEOF_LONG__ 8
c:\msys64\mingw64\bin>gcc.exe -x c++ -E -dM nul | findstr /i x86
#define __x86_64 1
c:\msys64\mingw64\bin>gcc.exe -x c++ -E -dM nul | findstr /i SIZEOF_LONG
#define __SIZEOF_LONG__ 4
Some gcc ports to Windows follow Windows conventions for types and sizes, and some use Linux conventions.
To improve compatibility between different versions and flavors of gcc compilers, we could use the queried system defines from the compiler to correct types and sizes.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
No se ha indicado ningún archivo del repositorio ni ninguna prueba. Comienza siguiendo el manejo codificado de forma fija de tipos y tamaños del analizador de IntelliSense y la ruta de consulta del compilador, usando los comandos gcc -E -dM mostrados como comportamiento de referencia. Se considera terminado cuando los defines informados por el compilador puedan corregir tipos y tamaños entre distintos ports y versiones de GCC.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp
- Área
- compilers, tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 28/100