From: Timur Tabi <timur@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] fix compilation problem for mpc8349itx CFG_RAMBOOT
Date: Wed, 23 May 2007 15:29:18 -0500 [thread overview]
Message-ID: <4654A41E.2060007@freescale.com> (raw)
In-Reply-To: <20070523195138.A061F35264A@atlas.denx.de>
Wolfgang Denk wrote:
> In message <46548B5B.4060607@freescale.com> you wrote:
>>> This is extremely inconsistent. Some CONFIG_COMMANDS_* (PCI, I2C) are
>>> used to add features, while others (FLASH) are used to remove
>>> features. I consinder this very error prone.
>> Well, it's supposed to be an alternative to what Nikita was proposing. I wanted to keep
>
> It's bad. Use something like __CMD_ADD_I2C or __CMD_REMOVE_FLASH or
> so, but don't use the same name for different functions.
Ok, I can change those names.
>
>> Please take a look at my MPC8349ITX.h to see the full extent of what I was trying to do.
>
> Yes, I know what it does. Frankly, it's ugly.
As Nikita pointed out, the ugliness is just a side-effect of the way CONFIG_COMMANDS is
defined and a limitation of C macros. A macro can only be defined once, and you can't put
#ifdefs inside the #define, so you have two choices:
1) Use #ifdefs around #define CONFIG_COMMANDS to have the compiler choose *which* version
of CONFIG_COMMANDS you want to actually compile
2) Create sub-macros (e.g. with __CMD_xxx) that are defined inside #ifdefs, and then make
CONFIG_COMMANDS a combination of those macros.
I believe that option #1 scales better than option #2, and therefore is easier to read.
>> Should they be renamed to CFG_COMMANDS_xxx?
>
> No, as CFG also has a specific meaning. Here, you just need
> temporary, local variables. Please avoid name space pollution. You
> can and should even #undef those after use.
As NIkita demonstrated, you can't undefine those macros.
--
Timur Tabi
Linux Kernel Developer @ Freescale
next prev parent reply other threads:[~2007-05-23 20:29 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-23 8:45 [U-Boot-Users] [PATCH] fix compilation problem for mpc8349itx CFG_RAMBOOT Nikita V. Youshchenko
2007-05-23 15:09 ` Timur Tabi
2007-05-23 15:37 ` Nikita V. Youshchenko
2007-05-23 15:55 ` Timur Tabi
2007-05-23 16:30 ` Wolfgang Denk
2007-05-23 16:50 ` Timur Tabi
2007-05-23 16:52 ` Timur Tabi
2007-05-23 18:59 ` Nikita V. Youshchenko
2007-05-23 19:08 ` Timur Tabi
2007-05-23 17:48 ` Timur Tabi
2007-05-23 18:38 ` Wolfgang Denk
2007-05-23 18:43 ` Timur Tabi
2007-05-23 19:51 ` Wolfgang Denk
2007-05-23 20:01 ` Nikita V. Youshchenko
2007-05-23 20:13 ` Nikita V. Youshchenko
2007-05-23 23:11 ` Wolfgang Denk
2007-05-24 8:10 ` Nikita V. Youshchenko
2007-05-24 12:36 ` Wolfgang Denk
2007-05-24 12:49 ` Jerry Van Baren
2007-05-24 15:25 ` Timur Tabi
2007-05-24 18:36 ` Jon Loeliger
2007-05-24 18:38 ` Timur Tabi
2007-05-24 19:43 ` Wolfgang Grandegger
2007-05-24 12:39 ` Wolfgang Grandegger
2007-05-23 20:29 ` Timur Tabi [this message]
2007-06-01 20:18 ` Kim Phillips
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4654A41E.2060007@freescale.com \
--to=timur@freescale.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox