Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
From: Varun Iyer <varun_iyer@posteo.net>
To: jim.cromie@gmail.com
Cc: kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: is there a macro symbol for strlen($LINUX_SOURCE_PATH)
Date: Wed, 4 Sep 2019 15:18:17 -0700
Message-ID: <20190904221817.gismdbom2rkdyfx6@varun-laptop> (raw)
In-Reply-To: <CAJfuBxzD8hCj_vetCPLCmOzgHF=dwaayGeNSCZQZwoaOEOvU_g@mail.gmail.com>

On 19/09/04 03:42PM, jim.cromie@gmail.com wrote:
> in the kernel, there are a lot of usages of __FILE__
> 
> this means that there are a lot of copies of fully rooted paths,
> including all the varying ~/src/linux prefixes used by individual builders.

On gcc, `__FILE__` is the path of the file relative to the directory that the
build is run from.

Try something like
 
#include <stdio.h>
#define testing() printf("%s\n", __FILE__)
int main() { testing(); }

and compile it from different directories to replicate this behaviour.

> 
> Id hazard a guess that something like __RELPATH_FILE__
> would work in many cases and perhaps even be more readable
> (by reducing long strings) in the generated output
> 
> Do the macros exist to cobble this together for compile-time ?
> Does it warrant a short name ? either to wrap __FILE__ uses or replace them ?
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 21:42 jim.cromie
2019-09-04 22:18 ` Varun Iyer [this message]
2019-09-05 14:31   ` jim.cromie
2019-09-05 20:23     ` Valdis Klētnieks
2019-09-05  5:47 ` Greg KH

Reply instructions:

You may reply publically 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=20190904221817.gismdbom2rkdyfx6@varun-laptop \
    --to=varun_iyer@posteo.net \
    --cc=jim.cromie@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /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

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org kernelnewbies@archiver.kernel.org
	public-inbox-index kernelnewbies


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/ public-inbox