avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [RFC] catching misspeeled signal names


From: Theodore A. Roth
Subject: [avr-libc-dev] [RFC] catching misspeeled signal names
Date: Mon, 19 Apr 2004 15:28:34 -0700 (PDT)

Hi,

Attached is an ugly little patch that allows gcc to catch misspeeled
signal names.

This works by inserting a syntax error into the function argument if the
signal name is misspeeled. For example, suppose that I do this:

  SIGNAL (fooooo_SIG_OUTPUT_COMPARE1B)
  {
  }

with this patch, gcc spits out this error:

  $ avr-gcc -g -Os -Wall -mmcu=atmega128  -save-temps   -c -o vtimer.o vtimer.c
  vtimer.c:24: error: syntax error before '(' token
  vtimer.c:24: warning: type defaults to `int' in declaration of 
`fooooo_SIG_OUTPUT_COMPARE1B'
  vtimer.c:24: warning: type defaults to `int' in declaration of `signal'
  vtimer.c:24: error: syntax error before ')' token

And if you look at vtimer.i (the preprocessed temp file), you see this
is what it got compiled to:

  fooooo_SIG_OUTPUT_COMPARE1B(("<- Misspelled SIG name"), signal) {
  ...
  }

Without the -Wall option you don't get as much of a hint, but the
compile still bombs out:

  $ avr-gcc -g -Os -mmcu=atmega128  -save-temps   -c -o vtimer.o vtimer.c
  vtimer.c:24: error: syntax error before '(' token
  vtimer.c:24: error: syntax error before ')' token

This patch is transparent to the end user.

---
Ted Roth
PGP Key ID: 0x18F846E9
Jabber ID: address@hidden

Attachment: avr-libc-misspeeled-sig.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]