public inbox for eudev@lists.gentoo.org
 help / color / mirror / Atom feed
* [eudev] [PATCH] use #pragma once for header files
@ 2017-12-04 11:34 Marcus Folkesson
  2017-12-05 18:15 ` Anthony G. Basile
  0 siblings, 1 reply; 4+ messages in thread
From: Marcus Folkesson @ 2017-12-04 11:34 UTC (permalink / raw
  To: eudev; +Cc: marcus.folkesson

Some headerfiles are missing "#pragma once" or corresponding
"#ifndef..." which may result in build error if multiple source files
include the same file.

Add "#pragma once" for concerned files.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 src/mtd_probe/mtd_probe.h | 2 ++
 src/scsi_id/scsi.h        | 2 ++
 src/scsi_id/scsi_id.h     | 2 ++
 src/shared/device-nodes.h | 2 ++
 src/shared/fileio.h       | 2 ++
 src/shared/path-util.h    | 2 ++
 src/shared/siphash24.h    | 3 +++
 src/shared/socket-util.h  | 2 ++
 src/udev/udevadm-util.h   | 2 ++
 9 files changed, 19 insertions(+)

diff --git a/src/mtd_probe/mtd_probe.h b/src/mtd_probe/mtd_probe.h
index e048a0122..caea5c269 100644
--- a/src/mtd_probe/mtd_probe.h
+++ b/src/mtd_probe/mtd_probe.h
@@ -17,6 +17,8 @@
  * Boston, MA  02110-1301  USA
  */
 
+#pragma once
+
 #include <mtd/mtd-user.h>
 
 #include "macro.h"
diff --git a/src/scsi_id/scsi.h b/src/scsi_id/scsi.h
index c423cac57..3f99ae772 100644
--- a/src/scsi_id/scsi.h
+++ b/src/scsi_id/scsi.h
@@ -10,6 +10,8 @@
  *        Free Software Foundation version 2 of the License.
  */
 
+#pragma once
+
 #include <scsi/scsi.h>
 
 struct scsi_ioctl_command {
diff --git a/src/scsi_id/scsi_id.h b/src/scsi_id/scsi_id.h
index 648b5ce42..141b116a8 100644
--- a/src/scsi_id/scsi_id.h
+++ b/src/scsi_id/scsi_id.h
@@ -15,6 +15,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#pragma once
+
 #define MAX_PATH_LEN 512
 
 /*
diff --git a/src/shared/device-nodes.h b/src/shared/device-nodes.h
index d27ac0906..5df53e8c0 100644
--- a/src/shared/device-nodes.h
+++ b/src/shared/device-nodes.h
@@ -17,5 +17,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#pragma once
+
 int encode_devnode_name(const char *str, char *str_enc, size_t len);
 int whitelisted_char_for_devnode(char c, const char *additional);
diff --git a/src/shared/fileio.h b/src/shared/fileio.h
index 641bf0230..7beed2eb8 100644
--- a/src/shared/fileio.h
+++ b/src/shared/fileio.h
@@ -17,6 +17,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#pragma once
+
 #include <stddef.h>
 #include <stdio.h>
 
diff --git a/src/shared/path-util.h b/src/shared/path-util.h
index 0123c2609..1d15d4c0f 100644
--- a/src/shared/path-util.h
+++ b/src/shared/path-util.h
@@ -17,6 +17,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#pragma once
+
 #include <stdbool.h>
 
 #include "macro.h"
diff --git a/src/shared/siphash24.h b/src/shared/siphash24.h
index 3253c179b..c2c19b437 100644
--- a/src/shared/siphash24.h
+++ b/src/shared/siphash24.h
@@ -1,3 +1,6 @@
+
+#pragma once
+
 #include <inttypes.h>
 #include <sys/types.h>
 
diff --git a/src/shared/socket-util.h b/src/shared/socket-util.h
index 2daa3279f..52b8dff66 100644
--- a/src/shared/socket-util.h
+++ b/src/shared/socket-util.h
@@ -17,6 +17,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#pragma once
+
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/un.h>
diff --git a/src/udev/udevadm-util.h b/src/udev/udevadm-util.h
index dba651fdd..37e4fe836 100644
--- a/src/udev/udevadm-util.h
+++ b/src/udev/udevadm-util.h
@@ -15,6 +15,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#pragma once
+
 #include "udev.h"
 
 struct udev_device *find_device(struct udev *udev,
-- 
2.15.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [eudev] [PATCH] use #pragma once for header files
  2017-12-04 11:34 [eudev] [PATCH] use #pragma once for header files Marcus Folkesson
@ 2017-12-05 18:15 ` Anthony G. Basile
  2017-12-05 18:28   ` Marcus Folkesson
  0 siblings, 1 reply; 4+ messages in thread
From: Anthony G. Basile @ 2017-12-05 18:15 UTC (permalink / raw
  To: Marcus Folkesson, eudev

On 12/4/17 6:34 AM, Marcus Folkesson wrote:
> Some headerfiles are missing "#pragma once" or corresponding
> "#ifndef..." which may result in build error if multiple source files
> include the same file.
> 
> Add "#pragma once" for concerned files.
> 
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> ---
>  src/mtd_probe/mtd_probe.h | 2 ++
>  src/scsi_id/scsi.h        | 2 ++
>  src/scsi_id/scsi_id.h     | 2 ++
>  src/shared/device-nodes.h | 2 ++
>  src/shared/fileio.h       | 2 ++
>  src/shared/path-util.h    | 2 ++
>  src/shared/siphash24.h    | 3 +++
>  src/shared/socket-util.h  | 2 ++
>  src/udev/udevadm-util.h   | 2 ++
>  9 files changed, 19 insertions(+)
> 
> diff --git a/src/mtd_probe/mtd_probe.h b/src/mtd_probe/mtd_probe.h
> index e048a0122..caea5c269 100644
> --- a/src/mtd_probe/mtd_probe.h
> +++ b/src/mtd_probe/mtd_probe.h
> @@ -17,6 +17,8 @@
>   * Boston, MA  02110-1301  USA
>   */
>  
> +#pragma once
> +
>  #include <mtd/mtd-user.h>
>  
>  #include "macro.h"
> diff --git a/src/scsi_id/scsi.h b/src/scsi_id/scsi.h
> index c423cac57..3f99ae772 100644
> --- a/src/scsi_id/scsi.h
> +++ b/src/scsi_id/scsi.h
> @@ -10,6 +10,8 @@
>   *        Free Software Foundation version 2 of the License.
>   */
>  
> +#pragma once
> +
>  #include <scsi/scsi.h>
>  
>  struct scsi_ioctl_command {
> diff --git a/src/scsi_id/scsi_id.h b/src/scsi_id/scsi_id.h
> index 648b5ce42..141b116a8 100644
> --- a/src/scsi_id/scsi_id.h
> +++ b/src/scsi_id/scsi_id.h
> @@ -15,6 +15,8 @@
>   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>   */
>  
> +#pragma once
> +
>  #define MAX_PATH_LEN 512
>  
>  /*
> diff --git a/src/shared/device-nodes.h b/src/shared/device-nodes.h
> index d27ac0906..5df53e8c0 100644
> --- a/src/shared/device-nodes.h
> +++ b/src/shared/device-nodes.h
> @@ -17,5 +17,7 @@
>    along with systemd; If not, see <http://www.gnu.org/licenses/>.
>  ***/
>  
> +#pragma once
> +
>  int encode_devnode_name(const char *str, char *str_enc, size_t len);
>  int whitelisted_char_for_devnode(char c, const char *additional);
> diff --git a/src/shared/fileio.h b/src/shared/fileio.h
> index 641bf0230..7beed2eb8 100644
> --- a/src/shared/fileio.h
> +++ b/src/shared/fileio.h
> @@ -17,6 +17,8 @@
>    along with systemd; If not, see <http://www.gnu.org/licenses/>.
>  ***/
>  
> +#pragma once
> +
>  #include <stddef.h>
>  #include <stdio.h>
>  
> diff --git a/src/shared/path-util.h b/src/shared/path-util.h
> index 0123c2609..1d15d4c0f 100644
> --- a/src/shared/path-util.h
> +++ b/src/shared/path-util.h
> @@ -17,6 +17,8 @@
>    along with systemd; If not, see <http://www.gnu.org/licenses/>.
>  ***/
>  
> +#pragma once
> +
>  #include <stdbool.h>
>  
>  #include "macro.h"
> diff --git a/src/shared/siphash24.h b/src/shared/siphash24.h
> index 3253c179b..c2c19b437 100644
> --- a/src/shared/siphash24.h
> +++ b/src/shared/siphash24.h
> @@ -1,3 +1,6 @@
> +
> +#pragma once
> +
>  #include <inttypes.h>
>  #include <sys/types.h>
>  
> diff --git a/src/shared/socket-util.h b/src/shared/socket-util.h
> index 2daa3279f..52b8dff66 100644
> --- a/src/shared/socket-util.h
> +++ b/src/shared/socket-util.h
> @@ -17,6 +17,8 @@
>    along with systemd; If not, see <http://www.gnu.org/licenses/>.
>  ***/
>  
> +#pragma once
> +
>  #include <sys/socket.h>
>  #include <netinet/in.h>
>  #include <sys/un.h>
> diff --git a/src/udev/udevadm-util.h b/src/udev/udevadm-util.h
> index dba651fdd..37e4fe836 100644
> --- a/src/udev/udevadm-util.h
> +++ b/src/udev/udevadm-util.h
> @@ -15,6 +15,8 @@
>   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>   */
>  
> +#pragma once
> +
>  #include "udev.h"
>  
>  struct udev_device *find_device(struct udev *udev,
> 


I know we have some clang users.  Does #pragma work for clang?

-- 
Anthony G. Basile, Ph.D.
Gentoo Linux Developer [Hardened]
E-Mail    : blueness@gentoo.org
GnuPG FP  : 1FED FAD9 D82C 52A5 3BAB  DC79 9384 FA6E F52D 4BBA
GnuPG ID  : F52D4BBA


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [eudev] [PATCH] use #pragma once for header files
  2017-12-05 18:15 ` Anthony G. Basile
@ 2017-12-05 18:28   ` Marcus Folkesson
  2017-12-06 12:27     ` Anthony G. Basile
  0 siblings, 1 reply; 4+ messages in thread
From: Marcus Folkesson @ 2017-12-05 18:28 UTC (permalink / raw
  To: Anthony G. Basile; +Cc: eudev

[-- Attachment #1: Type: text/plain, Size: 5685 bytes --]

Hi Anthony,

On Tue, Dec 05, 2017 at 01:15:59PM -0500, Anthony G. Basile wrote:
> On 12/4/17 6:34 AM, Marcus Folkesson wrote:
> > Some headerfiles are missing "#pragma once" or corresponding
> > "#ifndef..." which may result in build error if multiple source files
> > include the same file.
> > 
> > Add "#pragma once" for concerned files.
> > 
> > Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> > ---
> >  src/mtd_probe/mtd_probe.h | 2 ++
> >  src/scsi_id/scsi.h        | 2 ++
> >  src/scsi_id/scsi_id.h     | 2 ++
> >  src/shared/device-nodes.h | 2 ++
> >  src/shared/fileio.h       | 2 ++
> >  src/shared/path-util.h    | 2 ++
> >  src/shared/siphash24.h    | 3 +++
> >  src/shared/socket-util.h  | 2 ++
> >  src/udev/udevadm-util.h   | 2 ++
> >  9 files changed, 19 insertions(+)
> > 
> > diff --git a/src/mtd_probe/mtd_probe.h b/src/mtd_probe/mtd_probe.h
> > index e048a0122..caea5c269 100644
> > --- a/src/mtd_probe/mtd_probe.h
> > +++ b/src/mtd_probe/mtd_probe.h
> > @@ -17,6 +17,8 @@
> >   * Boston, MA  02110-1301  USA
> >   */
> >  
> > +#pragma once
> > +
> >  #include <mtd/mtd-user.h>
> >  
> >  #include "macro.h"
> > diff --git a/src/scsi_id/scsi.h b/src/scsi_id/scsi.h
> > index c423cac57..3f99ae772 100644
> > --- a/src/scsi_id/scsi.h
> > +++ b/src/scsi_id/scsi.h
> > @@ -10,6 +10,8 @@
> >   *        Free Software Foundation version 2 of the License.
> >   */
> >  
> > +#pragma once
> > +
> >  #include <scsi/scsi.h>
> >  
> >  struct scsi_ioctl_command {
> > diff --git a/src/scsi_id/scsi_id.h b/src/scsi_id/scsi_id.h
> > index 648b5ce42..141b116a8 100644
> > --- a/src/scsi_id/scsi_id.h
> > +++ b/src/scsi_id/scsi_id.h
> > @@ -15,6 +15,8 @@
> >   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> >   */
> >  
> > +#pragma once
> > +
> >  #define MAX_PATH_LEN 512
> >  
> >  /*
> > diff --git a/src/shared/device-nodes.h b/src/shared/device-nodes.h
> > index d27ac0906..5df53e8c0 100644
> > --- a/src/shared/device-nodes.h
> > +++ b/src/shared/device-nodes.h
> > @@ -17,5 +17,7 @@
> >    along with systemd; If not, see <http://www.gnu.org/licenses/>.
> >  ***/
> >  
> > +#pragma once
> > +
> >  int encode_devnode_name(const char *str, char *str_enc, size_t len);
> >  int whitelisted_char_for_devnode(char c, const char *additional);
> > diff --git a/src/shared/fileio.h b/src/shared/fileio.h
> > index 641bf0230..7beed2eb8 100644
> > --- a/src/shared/fileio.h
> > +++ b/src/shared/fileio.h
> > @@ -17,6 +17,8 @@
> >    along with systemd; If not, see <http://www.gnu.org/licenses/>.
> >  ***/
> >  
> > +#pragma once
> > +
> >  #include <stddef.h>
> >  #include <stdio.h>
> >  
> > diff --git a/src/shared/path-util.h b/src/shared/path-util.h
> > index 0123c2609..1d15d4c0f 100644
> > --- a/src/shared/path-util.h
> > +++ b/src/shared/path-util.h
> > @@ -17,6 +17,8 @@
> >    along with systemd; If not, see <http://www.gnu.org/licenses/>.
> >  ***/
> >  
> > +#pragma once
> > +
> >  #include <stdbool.h>
> >  
> >  #include "macro.h"
> > diff --git a/src/shared/siphash24.h b/src/shared/siphash24.h
> > index 3253c179b..c2c19b437 100644
> > --- a/src/shared/siphash24.h
> > +++ b/src/shared/siphash24.h
> > @@ -1,3 +1,6 @@
> > +
> > +#pragma once
> > +
> >  #include <inttypes.h>
> >  #include <sys/types.h>
> >  
> > diff --git a/src/shared/socket-util.h b/src/shared/socket-util.h
> > index 2daa3279f..52b8dff66 100644
> > --- a/src/shared/socket-util.h
> > +++ b/src/shared/socket-util.h
> > @@ -17,6 +17,8 @@
> >    along with systemd; If not, see <http://www.gnu.org/licenses/>.
> >  ***/
> >  
> > +#pragma once
> > +
> >  #include <sys/socket.h>
> >  #include <netinet/in.h>
> >  #include <sys/un.h>
> > diff --git a/src/udev/udevadm-util.h b/src/udev/udevadm-util.h
> > index dba651fdd..37e4fe836 100644
> > --- a/src/udev/udevadm-util.h
> > +++ b/src/udev/udevadm-util.h
> > @@ -15,6 +15,8 @@
> >   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> >   */
> >  
> > +#pragma once
> > +
> >  #include "udev.h"
> >  
> >  struct udev_device *find_device(struct udev *udev,
> > 
> 
> 
> I know we have some clang users.  Does #pragma work for clang?
> 

Actually I don't know. But #pragma is used for most of the headers already:

[19:21:38]marcus@little:~/git/eudev$ git grep pragma
src/shared/conf-files.h:21:#pragma once
src/shared/def.h:20:#pragma once
src/shared/dev-setup.h:20:#pragma once
src/shared/formats-util.h:1:#pragma once
src/shared/hashmap.h:3:#pragma once
src/shared/label.h:20:#pragma once
src/shared/list.h:3:#pragma once
src/shared/log.h:20:#pragma once
src/shared/macro.h:20:#pragma once
src/shared/mempool.h:3:#pragma once
src/shared/missing.h:20:#pragma once
src/shared/mkdir.h:20:#pragma once
src/shared/process-util.h:1:#pragma once
src/shared/random-util.h:1:#pragma once
src/shared/selinux-util.h:20:#pragma once
src/shared/set.h:3:#pragma once
src/shared/smack-util.h:22:#pragma once
src/shared/strbuf.h:20:#pragma once
src/shared/strv.h:20:#pragma once
src/shared/strxcpyx.h:20:#pragma once
src/shared/sysctl-util.h:3:#pragma once
src/shared/terminal-util.h:1:#pragma once
src/shared/time-util.h:20:#pragma once
src/shared/udev-util.h:20:#pragma once
src/shared/utf8.h:20:#pragma once
src/shared/util.h:20:#pragma once
src/shared/virt.h:20:#pragma once
src/udev/udev.h:19:#pragma once

Only a few headers in src/libudev/ is using the #ifndef-#define-#endif
what I can tell.

Maybe I should convert those to #pragma instead to keep it uniform.


Best regards
Marcus Folkesson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [eudev] [PATCH] use #pragma once for header files
  2017-12-05 18:28   ` Marcus Folkesson
@ 2017-12-06 12:27     ` Anthony G. Basile
  0 siblings, 0 replies; 4+ messages in thread
From: Anthony G. Basile @ 2017-12-06 12:27 UTC (permalink / raw
  To: eudev

On 12/5/17 1:28 PM, Marcus Folkesson wrote:
> Hi Anthony,
>
> On Tue, Dec 05, 2017 at 01:15:59PM -0500, Anthony G. Basile wrote:
>> On 12/4/17 6:34 AM, Marcus Folkesson wrote:
>>> Some headerfiles are missing "#pragma once" or corresponding
>>> "#ifndef..." which may result in build error if multiple source files
>>> include the same file.
>>>
>>> Add "#pragma once" for concerned files.
>>>
>>> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
>>> ---
>>>  src/mtd_probe/mtd_probe.h | 2 ++
>>>  src/scsi_id/scsi.h        | 2 ++
>>>  src/scsi_id/scsi_id.h     | 2 ++
>>>  src/shared/device-nodes.h | 2 ++
>>>  src/shared/fileio.h       | 2 ++
>>>  src/shared/path-util.h    | 2 ++
>>>  src/shared/siphash24.h    | 3 +++
>>>  src/shared/socket-util.h  | 2 ++
>>>  src/udev/udevadm-util.h   | 2 ++
>>>  9 files changed, 19 insertions(+)
>>>
>>> diff --git a/src/mtd_probe/mtd_probe.h b/src/mtd_probe/mtd_probe.h
>>> index e048a0122..caea5c269 100644
>>> --- a/src/mtd_probe/mtd_probe.h
>>> +++ b/src/mtd_probe/mtd_probe.h
>>> @@ -17,6 +17,8 @@
>>>   * Boston, MA  02110-1301  USA
>>>   */
>>>  
>>> +#pragma once
>>> +
>>>  #include <mtd/mtd-user.h>
>>>  
>>>  #include "macro.h"
>>> diff --git a/src/scsi_id/scsi.h b/src/scsi_id/scsi.h
>>> index c423cac57..3f99ae772 100644
>>> --- a/src/scsi_id/scsi.h
>>> +++ b/src/scsi_id/scsi.h
>>> @@ -10,6 +10,8 @@
>>>   *        Free Software Foundation version 2 of the License.
>>>   */
>>>  
>>> +#pragma once
>>> +
>>>  #include <scsi/scsi.h>
>>>  
>>>  struct scsi_ioctl_command {
>>> diff --git a/src/scsi_id/scsi_id.h b/src/scsi_id/scsi_id.h
>>> index 648b5ce42..141b116a8 100644
>>> --- a/src/scsi_id/scsi_id.h
>>> +++ b/src/scsi_id/scsi_id.h
>>> @@ -15,6 +15,8 @@
>>>   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>>>   */
>>>  
>>> +#pragma once
>>> +
>>>  #define MAX_PATH_LEN 512
>>>  
>>>  /*
>>> diff --git a/src/shared/device-nodes.h b/src/shared/device-nodes.h
>>> index d27ac0906..5df53e8c0 100644
>>> --- a/src/shared/device-nodes.h
>>> +++ b/src/shared/device-nodes.h
>>> @@ -17,5 +17,7 @@
>>>    along with systemd; If not, see <http://www.gnu.org/licenses/>.
>>>  ***/
>>>  
>>> +#pragma once
>>> +
>>>  int encode_devnode_name(const char *str, char *str_enc, size_t len);
>>>  int whitelisted_char_for_devnode(char c, const char *additional);
>>> diff --git a/src/shared/fileio.h b/src/shared/fileio.h
>>> index 641bf0230..7beed2eb8 100644
>>> --- a/src/shared/fileio.h
>>> +++ b/src/shared/fileio.h
>>> @@ -17,6 +17,8 @@
>>>    along with systemd; If not, see <http://www.gnu.org/licenses/>.
>>>  ***/
>>>  
>>> +#pragma once
>>> +
>>>  #include <stddef.h>
>>>  #include <stdio.h>
>>>  
>>> diff --git a/src/shared/path-util.h b/src/shared/path-util.h
>>> index 0123c2609..1d15d4c0f 100644
>>> --- a/src/shared/path-util.h
>>> +++ b/src/shared/path-util.h
>>> @@ -17,6 +17,8 @@
>>>    along with systemd; If not, see <http://www.gnu.org/licenses/>.
>>>  ***/
>>>  
>>> +#pragma once
>>> +
>>>  #include <stdbool.h>
>>>  
>>>  #include "macro.h"
>>> diff --git a/src/shared/siphash24.h b/src/shared/siphash24.h
>>> index 3253c179b..c2c19b437 100644
>>> --- a/src/shared/siphash24.h
>>> +++ b/src/shared/siphash24.h
>>> @@ -1,3 +1,6 @@
>>> +
>>> +#pragma once
>>> +
>>>  #include <inttypes.h>
>>>  #include <sys/types.h>
>>>  
>>> diff --git a/src/shared/socket-util.h b/src/shared/socket-util.h
>>> index 2daa3279f..52b8dff66 100644
>>> --- a/src/shared/socket-util.h
>>> +++ b/src/shared/socket-util.h
>>> @@ -17,6 +17,8 @@
>>>    along with systemd; If not, see <http://www.gnu.org/licenses/>.
>>>  ***/
>>>  
>>> +#pragma once
>>> +
>>>  #include <sys/socket.h>
>>>  #include <netinet/in.h>
>>>  #include <sys/un.h>
>>> diff --git a/src/udev/udevadm-util.h b/src/udev/udevadm-util.h
>>> index dba651fdd..37e4fe836 100644
>>> --- a/src/udev/udevadm-util.h
>>> +++ b/src/udev/udevadm-util.h
>>> @@ -15,6 +15,8 @@
>>>   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>>>   */
>>>  
>>> +#pragma once
>>> +
>>>  #include "udev.h"
>>>  
>>>  struct udev_device *find_device(struct udev *udev,
>>>
>>
>> I know we have some clang users.  Does #pragma work for clang?
>>
> Actually I don't know. But #pragma is used for most of the headers already:
>
> [19:21:38]marcus@little:~/git/eudev$ git grep pragma
> src/shared/conf-files.h:21:#pragma once
> src/shared/def.h:20:#pragma once
> src/shared/dev-setup.h:20:#pragma once
> src/shared/formats-util.h:1:#pragma once
> src/shared/hashmap.h:3:#pragma once
> src/shared/label.h:20:#pragma once
> src/shared/list.h:3:#pragma once
> src/shared/log.h:20:#pragma once
> src/shared/macro.h:20:#pragma once
> src/shared/mempool.h:3:#pragma once
> src/shared/missing.h:20:#pragma once
> src/shared/mkdir.h:20:#pragma once
> src/shared/process-util.h:1:#pragma once
> src/shared/random-util.h:1:#pragma once
> src/shared/selinux-util.h:20:#pragma once
> src/shared/set.h:3:#pragma once
> src/shared/smack-util.h:22:#pragma once
> src/shared/strbuf.h:20:#pragma once
> src/shared/strv.h:20:#pragma once
> src/shared/strxcpyx.h:20:#pragma once
> src/shared/sysctl-util.h:3:#pragma once
> src/shared/terminal-util.h:1:#pragma once
> src/shared/time-util.h:20:#pragma once
> src/shared/udev-util.h:20:#pragma once
> src/shared/utf8.h:20:#pragma once
> src/shared/util.h:20:#pragma once
> src/shared/virt.h:20:#pragma once
> src/udev/udev.h:19:#pragma once
>
> Only a few headers in src/libudev/ is using the #ifndef-#define-#endif
> what I can tell.
>
> Maybe I should convert those to #pragma instead to keep it uniform.
>
>
> Best regards
> Marcus Folkesson


Yeah let's switch everything to #pragma and get rid of the ifndefs. 
clang does respect gcc's #pragma's.  See

http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas

I think a single commit in which you sqaush your previous commit
together with removing the ifndefs would be best.  The commit message
could be something like "consistenlty use #pragma to avoid double
inclusion of headers" or similar.

-- 
Anthony G. Basile, Ph.D.
Gentoo Linux Developer [Hardened]
E-Mail    : basile@freeharbor.net
GnuPG FP  : 1FED FAD9 D82C 52A5 3BAB  DC79 9384 FA6E F52D 4BBA
GnuPG ID  : F52D4BBA



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-06 12:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-04 11:34 [eudev] [PATCH] use #pragma once for header files Marcus Folkesson
2017-12-05 18:15 ` Anthony G. Basile
2017-12-05 18:28   ` Marcus Folkesson
2017-12-06 12:27     ` Anthony G. Basile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox