driver: an unknown --opt= goal should name the valid goals

Abierto Apto para principiantes
#190 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
83/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
c
Área
cli

Línea de trabajo

Lee el manejo de --pass=/--no-pass= cerca de la línea 8580 en src/driver/main.c y las entradas de --opt= en src/driver/options.def (líneas 114–121). Añade cobertura en tests/golden/options-table.sh o tests/golden/gcc-flags.sh y comprueba que un objetivo no válido enumera los objetivos válidos y omite el texto de uso. Se considera terminado cuando el mensaje se genera a partir de la tabla de opciones y pasan las pruebas.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement good first issue

Context. --opt= takes a goal (none, basic, debug, speed, max, size, min-size). A wrong one gets a generic error and the whole usage text:

$ ./embcc --opt=sped -c t.c
embcc: error: unknown argument '--opt=sped'
usage: embcc [-c|-S|-E] SOURCE... [-o FILE] ...

--pass= already does better: embcc: error: --pass=X: no optimizer pass has that name; the passes are a, b and c. --opt= should do the same, and suggest the closest goal.

Where.

  • src/driver/main.c, around line 8580: the --pass= / --no-pass= branch, which is the pattern to follow. The generic unknown argument error comes right after it.
  • src/driver/options.def, lines 114–121: the --opt= goals are entries in the option table, so the list does not need typing in again.
  • Tests: tests/golden/options-table.sh and tests/golden/gcc-flags.sh already check option errors.

Steps.

  1. When opt_typed(argv[i]) starts with --opt= and matched no entry, print embcc: error: --opt=sped: not a goal; the goals are none, basic, debug, speed, max, size and min-size. Build the list from the option table.
  2. Optionally, add did you mean --opt=speed? when one goal is close.
  3. Add a test that checks the message, and that the usage text is no longer printed.

Done when an unknown --opt= names the valid goals, the list comes from options.def (adding a goal there updates the message), and the tests pass.

Before you start: the contributor's guide has the rules. A new test counts only after it has failed against the code before your change, and a commit subject reads area: summary. Questions are welcome in the comments or in Discussions.

Lenguaje dominante
C
Estrellas
1
Forks
2
Merge medio
20 h 55 min
PR fusionados (30 d)
73

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de EmbLinkOs/EmbCC

Todos los issues de EmbLinkOs/EmbCC

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.